How to make a calculator in Android Studio 2020 | Part 1
HTML-код
- Опубликовано: 24 ноя 2024
- In this video, learn how to make a calculator in Android Studio using Java. This calculator will be able to perform many functions like calculating exponentials, basic arithmetic, and you will also be able to use parentheses. All of this will be made possible through the use of a math parser called Mxparser. You will learn how you can download the Mxparser library and use it in your Android Studio projects.
We will be covering some of the core functions and techniques used for app development in Android Studio. This tutorial is designed for beginners trying to get started in app development with Android devices being the primary target.
Android Studio is a great platform for creating apps that can be deployed on the google play store. If you're new to the series I'd go and check out the Android Studio Playlist. There you will be able to see how to create basic apps so you can become a developer.
Join the Discord Server!!!
/ discord
Check out the Android development playlist for more videos like this!
• Android App Developmen...
#androidstudio #appdevelopment #PracticalCoding
Hi, I am Iranian, but I subscribed you because of the quality of your training. Thank you for your good tutorials
Glad you're liking the videos!
More Android Tutorials pls, this is amazing!
This is the best cool tutorial to learn how to use layouts!! Saludos desde Venezuela
You make great movies. They helped me learn how to make apps.
Thanks! Glad I could help you out
@@PracticalCoding hello can you please help me understanding this page: developer.android.com/guide/topics/graphics/drawable-animation#java
Dude why are you not popular!
@@PracticalCoding I wish you the best of luck, Love your vids
We're getting there. Slowly but surely
@@PracticalCoding yeah!
@@PracticalCoding still not
The best android app tutorial I have ever seen !
The way of Teaching is Like WOW !!!
Thanks! Glad you liked the video
Now I can see clearly , thanks for zooming the things 😊
No problem!
better than my teacher in university thank youuu😁
That's good to hear!
True
same T-T
You deserve so much more man
Thank you so much, without this video my homework would be so much harder
That's great to hear. Glad the video helped you out!
Thank you love from india 🙂
this tutorial vid help me with my school project thanks brother
you are great.... if you continue like this you will definitely have 100K+ subscribers... we'll support you
Thanks! Glad you're liking the videos!
When I added the line which makes the buttons border less, the buttons (including the texts inside) were all invisible in design mode (not blueprint view). And there are some other parts of the tutorial that does not match my version of Android Studios, which includes: it does not have the error for the table layout (which does not have a constrain). Could that be the case? This is a very good video and I thank you greatly for making it. :)
I am using the newest version of Android Studios.
It's good to hear you're liking the video series so far. I'm actually not sure why the text would disappear from the buttons but the background should defiantly be gone. If the text isn't set to a color other than white, it should be displayed in the preview. Did you end up figuring out what was wrong?
@@udemycourses725 I had the same problem, u need to head over to themes.xml and change the item name to black
@@KK-by6gk Thank you for the help! I figured out an alternative solution to this several weeks ago, I will share it later.
@@KK-by6gk thanks for the solution
Nice video, making a pretty calculator, now, how to disable refactor every time that i change id of buttons? so tedious.
Bro u are awesome
Damn Im new in android I love this kind of tutorial clear and detailed. Auto subscribe
Glad you're liking it!
nice please make more android tutorial if possible for you....thanks your expansion it good easy to understand
nice and clean explanation bro make it easy with clear voice also
I know java ,c and c++ .
I wrote all codes for calculator but then how to make an app from it ?
For Windows and Mobile ??
What is your buttons color?
Thanks for the video!
Wheres the setup video you was on about :)
The setup video? You know I haven't watched this video in ages. To be honest the code in this video isn't great (kinda amazing how much you can learn in a year). I'd take a look at the new calculator series I posted a while back. The code and video quality is so much better. Here's the link if you wanna check that series out instead
ruclips.net/p/PLcSIMAULmMycI309W6uMMaQX1ePy8_1iV
Great vid but what gradle version ? u are using ?
I'm not sure about this video. It was over a year ago. I would check out the newer series I made a few months back. The new series takes into account all the new changes in Android Studio
Here's the link to the video series if you want to watch that one instead
ruclips.net/p/PLcSIMAULmMycI309W6uMMaQX1ePy8_1iV
Wow.You are Awesome.Plz upload more videos.All the best
Thanks! I plan on uploading a bunch of videos. I have a big list of video ideas. If you ever have anything you want me to make a video on just let me know and I'll see what I can do about creating it. Already made a couple videos for a few people.
@@PracticalCoding Well.......I think I need some tutorial on "for loop,do while loop,catch try,if else,arrays,break/continue,file handling,thread,boolean"all explanation and usage and how to connect them with android app.Thanks a lot.
@@creativestudio7885No problem! I'll see what I can do about working that stuff in for you
@@PracticalCoding Thanks a Lot..All the Best
why you have only 1.8 K subs??? you teach so well bro...i recommended this to my 3 friend find this video helpfull. you deserve more
Thanks for telling more people about the channel! It really helps out. I think it's because I don't have that many videos out but who knows. I'm just happy to get a few subscribers each day. Better than none!
@@PracticalCoding ohh...there are actually few video
@@shaikhnabeel6443 ruclips.net/video/158y2bGVgfM/видео.html
for some reason I can't drag the constraint layout of the tablelayout
Cool, this is help me a lot. Thanks
I'm glad the video was helpful
A really cool video but im having a problem. When i created the buttons their backround color was purple and the color of the text was white, so when i made the buttons borderless they all became white. What should i do?
If your buttons were purple by default, then you're probably using the newer version of Android Studio. They changed a few things around and now, to change the background for the buttons, you have to mess with the themes folder. There's a style tag in both the normal and night theme which has a parent attribute. You just need to change it to
Theme.AppCompat.Light.NoActionBar
Right now, I'm working on a new calculator series to account for the update. I have two videos out already and I plan on getting the next posted this Monday. Here's the link to the first video if you wanna check it out (It'll show you how to change the parent attribute in your themes folder)
ruclips.net/video/1ssYYy8Li48/видео.html
Hope this helps you out! If it doesn't just let me know
@@PracticalCoding Thanks bro it worked
Can a FM Radio (not Online) be created in Android Studio? How?
Sir how you did you get symbols of multiplication and divide at 3:03 min
pls ans
You have to use alt codes to get the special characters to pop up. Here are the codes or you can just copy the symbol I put next to it if you want
multiplication (alt + 0215) = ×
division (alt + 0247) = ÷
@@PracticalCoding thanks sir if I will write that symbol does it will show me the error or not
@@rudrasavani3816 If you copy that symbol into the string tags, you shouldn't get an error
@@rudrasavani3816 ruclips.net/video/158y2bGVgfM/видео.html
pls help me my style.xml file is not their so i am not able to remove borders of buttons pls help me
Android Studio changed some stuff around since I posted this video. If you wanna follow along with this series, what you'll have to do is open up the following folder
res > values > themes
In the themes folder, you should see two files named the same thing. Open both and in the style tag, there should be a parent attribute. Change it to one of the following
Theme.AppCompat.Light
Theme.AppCompat.Light.NoActionBar
You have to do this for both files or you might get some unexpected results. If you want to watch me do that, I made a new calculator series that shows the exact same steps I just described. Here's the link to that video series if you'd rather do that
ruclips.net/p/PLcSIMAULmMycI309W6uMMaQX1ePy8_1iV
And if you're having trouble with anything else, you can always join this channel's Discord server to get help too. Here's the link if you wanna check it out
discord.gg/H2P89STbaS
5:17 or you can type windows+;
and type the math symbols from keyboard appeared
How I show various results in one screen???
How to add backspace ?? Please reply
Great tutorial 👍
Amazing
I rly appreciate your work
Thanks! Glad you're liking the videos. Always happy to hear that
Love u from india
Agr style.xml na ho or themes.xml ho too ?
How to use color library like @color/colorAccent in style.xml ?
Hey, sorry for the late reply. If you wanted to use a color in a style, all you should have to do is something like this
@color/green
whats the benefit or purpose of not hardcoding the button values? those values arent going to be changing right?
Yeah, for the most part, those strings should never change. The reason why I added the strings into the strings.xml file is by doing it this way, the string tags act almost like a function. You can place that string reference anywhere in your app, and if you want to make a change to that value, you only have to do it in the resource file. Also, if you were to make an app that supports multiple languages, you have to put all the strings you're using in the resource file because Android will use that file to make the translations. For this simple app, you don't have to make the reference to the string resource file if you don't want to, but I thought it would be good to show everyone some best practices when making an app.
Hope that helped!
ruclips.net/video/158y2bGVgfM/видео.html
Thank you from indonesia :)
Happy to help
@@PracticalCoding i got some issue with the buttons they start with purple color when i change using style borderless command they just completely gone not even the text left behind it become blank, also for me it start without style.xml for some reason
@@accessdenied5998 I made this video before I updated Android Studio. To follow along with this series you have to go into your themes folder and change each of the XML files a bit. you need to change the parent attribute in the style tag to this
Theme.AppCompat.Light.NoActionBar
I made a newer version of this series that is all up to date and will walk you through the process. Here's the link if you wanna watch that instead
ruclips.net/video/1ssYYy8Li48/видео.html
this was amazing...keep making videos sir...take love
Thanks! Good to hear you liked the video
Cannot resolve method 'calculate' in 'Exception'
my buttons have other constant color when i am trying to change it by background and backgroundTint, but backspace color changing, how can i fix it ?
Hey when I made this video series, Android Studio wasn't using Material Design as the default theme for the views. What you'll have to do is go into your themes folder (the light and night themes) and change the parent attribute to
Theme.AppCompat.Light.NoActionBar
And you should be good to go. Let me know if you're still running into any issues once you change that
If you're having trouble with anything, you can always join this channel's Discord server to get help too. Here's the link if you wanna check it out
discord.gg/H2P89STbaS
great explanation bro
Thanks!
May I ask what version of AS and apk are you using for this project?
I really don't remember what the exact version is but I'm about 90% sure that it was before 4.1 I made a newer version since they changed some stuff around if you want to check that series out instead
Here's the link:
ruclips.net/video/1ssYYy8Li48/видео.html
@@PracticalCoding OMG you're amazing! Thank you.
THX FOR TEACHING ME
No problem. Happy to help
I subs you bro..keep in rock
Glad you're liking the videos!
Sir I can't find the( style folder) in res folder what I can do?
Hey! When I made this video, Android Studio had that folder but with the recent update it was removed and the new themes folder was added in. All you have to do is go into the themes folder (should be in the res folder) and open up both of the XML files contained within there. Then you're gonna have to change the parent attribute in the style tag to one of the following depending on whether or not you want the action bar to be displayed
Theme.AppCompat.Light
OR
Theme.AppCompat.Light.NoActionBar
If you're still having trouble getting that to work, I made an updated calculator series that'll show you how to do it. Here's the link to the playlist if you wanna check it out
ruclips.net/p/PLcSIMAULmMycI309W6uMMaQX1ePy8_1iV
ofarin
I use caculator all in one it has algebra geometry and finance and Miscellaneous and loads of other features that is the best one😁
After applying 0dp layout width to all , the table I made disappeared. Can u guide me on this 🙏
Hey! I think I'd be able to help you out more if you joined this channel's Discord server. That way, you can send some pictures of what's happening. Whenever there's a graphical issue I always have people to join because it's really difficult to solve these issues without looking at Android Studio.
Here's the link If you wanna join
discord.gg/H2P89STbaS
If you don't have a Discord account, I can do my best to help you out here too. Let me know what you end up doing
When i did the borderless step my text of the buttoms disappeared
u may copy and past button into the tables after first one. If you wish just sharing.
@@PracticalCoding Video was still great i do have some advice to make the viewer experience more pleasant but only if you care to know lol. Also i tried the tutorial but it didnt work out though im going to try it again its my error im sure. Video was still great!
@@PracticalCoding how can we talk dm? I've got a discord. It's just more productive that way.
@@PracticalCoding i sent u a message did u get it?
@@PracticalCoding sent
@@immortalmonsterhybrid975 ruclips.net/video/158y2bGVgfM/видео.html
sir why did the text disappeared after I put style="@style/Widget.AppCompat.Button.Borderless" in each button. Hope you can still answer this
By default, the text color is white. Make sure you change the text color to something other than white. If you keep following along, we should add a background to all of the buttons and you'll be able to see the text again. To change the text color just place this XML code in your button tags
android:textColor="@color/black"
ruclips.net/video/158y2bGVgfM/видео.html
there seems to be no styles.xml in my values is it colors?
?
I made this app before updating to Android Studio 4.x If you want to watch an updated version of this project, just follow this link to my new calculator series
ruclips.net/p/PLcSIMAULmMycI309W6uMMaQX1ePy8_1iV
@@PracticalCoding alright thanks
Hi the androidstudio version I have is 4.1 and whenever I try to use edittext it shows me a rendering problem
Hey, so there's a few things you can do to fix this. Probably the best thing you could do would be to watch my updated video series on how to make a calculator. Here's the link to the If you want to check it out:
ruclips.net/p/PLcSIMAULmMycI309W6uMMaQX1ePy8_1iV
But you can also go into your themes folder and you should find 2 XML files in there. you need to change the parent attribute in the style tag to this
Theme.AppCompat.Light.NoActionBar
You'll have to do it for each XML file. If that's a little confusing, I go over how to do it in the updated series
@@PracticalCoding thank you for your reply I actually just restarted the application after updating and adding the new plugin and it worked I will surely watch the updated video
@@cuberforever8890 Sweet. Glad you got it to work
my button stuck on default color. I copy pasted your code and everything. Why is that?
Hey, you're probably using the newest version of Android Studio. You'll have to go into the themes folder and change a few things around to get everything to work. Honestly, if I were you, I'd go just watch the newer calculator series I posted a few months ago. Here's the link if you wanna check it out
ruclips.net/video/1ssYYy8Li48/видео.html
If you want to keep working on this calculator series, you'll have to open up the themes folder. Should be in the res > values > themes. In there, there should be two XML files (one for the default theme and a night theme) open both of them up and then change the parent attribute in both style tags to the following
Theme.AppCompat.Light.NoActionBar
If that made no sense, I go over how to do all of the steps in the new calculator series. You can always watch it to figure out how to do that and come back to this tutorial if you want.
Hope that helps!
Sir why did we made button width 0 dp
Hey! The reason why we assigned the width of the button as 0dp is so each child uses the same amount of space on the screen. The syntax for this is a little odd I think but that's just the way Android Studio wants you to do it. It's basically saying to make the width of each button as large as possible to fit on the user's screen.
Hope that helps!
Thanks bro
Happy to help!
is this use java or kotlin?
This is in Java
can you provide source code in zip format
ruclips.net/video/158y2bGVgfM/видео.html
How can we find out anti log using android calculator
If you want to calculate that, you're going to have to modify what I do in this video series a little bit. You can defiantly do it with mXparser if you want. They support a ton of math operations. I'd recommend taking a look at their website to see everything they offer. Here are a few links to their site about using the trigonometric functions with their library:
mathparser.org/mxparser-math-collection/unary-functions/
mathparser.org/mxparser-tutorial/using-built-in-functions/
ruclips.net/video/158y2bGVgfM/видео.html
i cant find where is exponent Clue/Key
@@PracticalCoding how about the divide symbol?
The exponent symbol I used is the one on the number six. So if you hold down the "shift + 6" buttons on your keyboard, it should pop up. If you still can't find it, you can always copy and past it from here: ^
@Ame Richard Molaole oh yeah you have to use an alt code to get it. It's "Alt + 0247"
Here it is if you want to just copy and paste it:
÷
how to change calculator coding in mobile
What do you mean by that?
why i dont have style.xml?
\
So there was a new update for Android Studio that removed that folder and by default will create a themes folder. Android Studio now uses Material design as the default them for the views that you place into the activity. If I remember correctly, you should still be able to follow along with the video series.
@@PracticalCoding Hey followed along and while it does appear to change the style the borders are still on
I have a folder named themes.xml
@@Beatboxbizboy Hey one thing you could try to do is going into each theme file (the normal and night XML files) and changing the parent the style uses to this
Theme.AppCompat.Light.NoActionBar
I'm working on a new calculator series right now to accommodate the new update. Just posted the first video. Here's the link if you want to check it out
ruclips.net/video/1ssYYy8Li48/видео.html
@@PracticalCoding thank you very much!
Where I can find source code?
Here's the link to the GitHub page
github.com/Practical-Coding3/calculatorApp
ruclips.net/video/158y2bGVgfM/видео.html
Hey can you send me the project please
Here you go
github.com/Practical-Coding3/calculatorApp
bro i just need the code i have a quiz
Here's the link to the calculator app on my GitHub page
github.com/Practical-Coding3/calculatorApp
I don’t have a styles.xml
:(:(
What should I do
@@PracticalCoding hi thanks for responding. It wasn’t there when I downloaded it today. I tried to create one but all the “@color/“ things I type are red. I tried to continue but when when I typed in styles=“@style/Widget.AppCompat.Button.Border” in activity.main nothing changes on my app. I typed it in correctly
@@PracticalCoding the colors and the string was created just not styles. I typed the right borderless in the code but it isn’t working and not making my app borderless
@@PracticalCoding ok I think I got it to work thank you!
Thanks for skipping so many details
sir i dont have style in values
Hey, so Android Studio's new update removed that file and replaced it with the themes folder. You should be good to still follow along with the tutorial.