How to make a scientific calculator in Android Studio 2021 | Part 3

  Рет қаралды 16,510

Practical Coding

Practical Coding

Күн бұрын

In this video, you will learn how to make a calculator in Android Studio using Java. This scientific calculator will be able to perform many functions like calculating exponentials, basic arithmetic, trig and inverse trig functions, and much more! 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.
Join the Discord Server!!!
/ discord
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.
Check out the Android development playlist for more videos like this!
• Android App Developmen...
Here's the link to the GitHub repository:
github.com/Pra...
mXparser Download Page
mathparser.org/...
Here's the Import you need to add to your java file
import org.mariuszgromada.math.mxparser.*;
#androidstudio #appdevelopment #PracticalCoding

Пікірлер: 104
@PracticalCoding
@PracticalCoding 3 жыл бұрын
If you have any questions you can always join the Discord server too. Here's the link if you wanna stop by discord.gg/evK6jwg4Xj
@rashmininayanathara5304
@rashmininayanathara5304 3 жыл бұрын
This is a really good tutorial, all the points are clearly mentioned. I'm waiting for the rest of the calculator
@PracticalCoding
@PracticalCoding 3 жыл бұрын
Glad you're liking the video! I just recorded the last part today. I was hoping to get the final part out tomorrow, but it's looking like it's going to be posted Tuesday
@mustafakhakwani197
@mustafakhakwani197 2 жыл бұрын
i have installed jdk 17 but MathParser dont have the jdk 17 in bin folder than now how could i solve the problem
@adrianojose7172
@adrianojose7172 3 жыл бұрын
Thank you for the video!!! Tip: Press CTRL+F9 to build to see if you have any errors before running. I ran mine and the keys weren't updating the text xD I forgot some closing parenthesis xD
@adrianojose7172
@adrianojose7172 3 жыл бұрын
even pressing run will show the error but, you will have to restart the emulator again
@PracticalCoding
@PracticalCoding 3 жыл бұрын
Didn't even know you could do that. I always hate having to restart the emulator when I do something wrong. I'll have to try it out sometime
@eliseubarros
@eliseubarros Жыл бұрын
My updateText method doesnt work because symbol: method setSelection(int) location: variable display of type TextView
@ProGamer2017
@ProGamer2017 2 жыл бұрын
Thank you so much
@kanedesierto7676
@kanedesierto7676 2 жыл бұрын
my jdk is 17 where i can find that specific file? i can't execute properly the equals button , hoping that u'll answer my question
@todoentecnologiayt
@todoentecnologiayt 2 жыл бұрын
Same... Did you solved it?
@sreelekshmi493
@sreelekshmi493 2 жыл бұрын
I got a problem while running the app, that is when I click on buttons it's not responding and, I get a warning that the Android older platform is broken ... Can you plz help me
@alexandrailyich2531
@alexandrailyich2531 Жыл бұрын
Cannot resolve method 'replaseALL' in 'String'
@siddheshbhalerao8494
@siddheshbhalerao8494 3 жыл бұрын
you are just wow bro keep going we inspire from u and THANK YOU for this amazing content
@PracticalCoding
@PracticalCoding 3 жыл бұрын
Thanks! Always good to hear when someone likes the videos I put out
@Manishkumar-wt9tf
@Manishkumar-wt9tf Жыл бұрын
I want to to add a button of history how to do that?
@tasnuvamehnaz
@tasnuvamehnaz 2 жыл бұрын
I am desgining the calculator in a fragment but My onClick methods can not be located from fragment's XML file.pls help
@walangpart2
@walangpart2 2 жыл бұрын
I suggest making another calculator tutorial where in you are gonna cover these, "square roots that wraps a number, not just √56666 instead a line will appear on top of the numbers, also enable factorial of decimals and adding DEGRESS AND RADIANS switch for the trigonometric functions" been researching for days and I can't find any thing useful
@eliseubarros
@eliseubarros Жыл бұрын
The setSelection () doesnt work...what i'm doing wrong? 13:47
@mohamedhussien2101
@mohamedhussien2101 2 жыл бұрын
Great
@TuberEver
@TuberEver 3 жыл бұрын
Nice design! Thank you
@muhammadwaleedijaz5651
@muhammadwaleedijaz5651 2 жыл бұрын
how to remove .0 from the answer ? get answer without decimal format ??
@PracticalCoding
@PracticalCoding 2 жыл бұрын
Unfortunately, I'm not aware of any "setting" for mXparser that allows you to do that. What you'll have to do is write some of your own logic to modify the String mXparser gives you and then update the display with your modified String
@Phiojay
@Phiojay 2 жыл бұрын
what do i do if mXparser does not have my java version. coz im using java version 15.0.2?
@PracticalCoding
@PracticalCoding 2 жыл бұрын
Unfortunately, mXparser doesn't support all of the JDKs. What I've always had people try in the past is using whatever version I used in the video. I know I didn't match the JDK on my system (even though you probably should) and it still worked. I've seen a few people have luck with JDK 8 and 11. I'd try those out to see if they end up working. If you can't get one to work, then you'll have to use a JDK that's supported by mXparser
@yazanmahfod8533
@yazanmahfod8533 3 жыл бұрын
Thank you very much 👍
@virinchisrao7138
@virinchisrao7138 3 жыл бұрын
I am using jdk version 16, so what should I add as the library? I tried using jdk13 file(in mathParser) it is showing me the error as "Unsupported class file major version 57."
@PracticalCoding
@PracticalCoding 3 жыл бұрын
I would try using jdk 8 and if that doesn't work then you'll have to use an older jdk to use mXparser
@arbinshrestha5454
@arbinshrestha5454 3 жыл бұрын
@@PracticalCoding is there any other way to install math parser for jdk 16?
@virinchisrao7138
@virinchisrao7138 3 жыл бұрын
@@arbinshrestha5454 try importing jdk 9 library, it worked for me
@arijitmajumdar7787
@arijitmajumdar7787 3 жыл бұрын
My jdk version is 15.0.2 so how do i install mXparser for that? its not given on the link
@arbinshrestha5454
@arbinshrestha5454 3 жыл бұрын
if you got the answer of that question please tell me too!
@PracticalCoding
@PracticalCoding 3 жыл бұрын
Hey! It looks like mXparser still hasn't made a jar file for that jdk yet. What I would try to do is use an older jdk file. A few people in this channel's Discord server have gotten older versions to work. I would try using the jdk 8 jar file first and if that doesn't work try 11. Those were the ones that seemed to have the most success
@mollakamrul195
@mollakamrul195 3 жыл бұрын
Wow...keep going
@paulhaddison
@paulhaddison 3 жыл бұрын
I love the app, but when I try to use the Expression statement, and build the app, I get this error: Expression exp = new Expression(userExp); ^ bad class file: C:\Users\paulh\.gradle\caches\transforms-2\files-2.1\fcb302bf21b5094bc2d410f99b6f1724\jetified-MathParser.org-mXparser-v.4.4.0-jdk11.jar(org/mariuszgromada/math/mxparser/Expression.class) class file has wrong version 55.0, should be 52.0 Please remove or make sure it appears in the correct subdirectory of the classpath. (I can't find any reference to a version number of any kind, and when I removed the folder and rebuilt the app, the folder appeared again. I am using Java 11. Any help would be greatly appreciated.)
@abdullahudi5971
@abdullahudi5971 3 жыл бұрын
Thanks
@MYWORLD-gg1xq
@MYWORLD-gg1xq 2 жыл бұрын
Nice👍
@zubaer21
@zubaer21 3 жыл бұрын
Egerly waiting for next video, when the next one will be available bro? You are awesome. Just keep it up.
@PracticalCoding
@PracticalCoding 3 жыл бұрын
I'm planning on recoding the final part after I take my exam tomorrow. Hopefully, the video won't be too long and I can get it out on Monday. We'll see what happens though.
@PracticalCoding
@PracticalCoding 3 жыл бұрын
Just wanted to let you know that I recorded the last part. It was a lot longer than I thought so I'll be editing it tomorrow and the video will be out Tuesday
@zubaer21
@zubaer21 3 жыл бұрын
Brother how can i solve null problem. When i open the app first time it shows null in edittext automatically. How can i solve this problem. Thanks in advance.
@rekhasherly9060
@rekhasherly9060 3 жыл бұрын
I have changed my jdkversion but it is not pasting into libs
@PracticalCoding
@PracticalCoding 3 жыл бұрын
Did you try the good old drag and drop method to get it in the folder? You could also use the file manager to paste the mXparser jar file into the libs folder if Android Studio is just being weird
@wesmatola5260
@wesmatola5260 3 жыл бұрын
How do i make the equal perform subsequent actions
@PracticalCoding
@PracticalCoding 3 жыл бұрын
I'm not sure what exactly happened in this video but I think we get the equals button working in video 4
@vilrash8523
@vilrash8523 3 жыл бұрын
I am using IntelliJ IDEA for development. I added the mXparser library like in the video, but I got an error ".mariuszgromada.math.mxparser does not exist". The JDK version is the same. What could be the problem? Because of one mistake, I would not like to install Android Studio and start development over again.
@PracticalCoding
@PracticalCoding 3 жыл бұрын
I gotcha. I wouldn't want to start over either. I've never developed an app in IntelliJ before so I can't tell you exactly what you'd need to do. From the error message though, it looks like the library wasn't added correctly. What I would do is look up how to add an external library to an IntelliJ project and go from there. Another thing I would make sure of is that you're using the correct jar file. If you have JDK 11 installed on you're computer and you end up using the JDK 13 jar file you can also run into issues that way too
@muhammadwaleedijaz5651
@muhammadwaleedijaz5651 2 жыл бұрын
Nice tutotrial but wanna ask one think what is the alternative way of btnEqual() functiion to solve math expressions and we dont wannt to use library then how we can do this function logically ?? if un know then please upload another video thanks !😊
@PracticalCoding
@PracticalCoding 2 жыл бұрын
Yeah, I see what you mean. Using the library isn't ideal but the problem is with parsing the String. The goal I had for this video wasn't to show everyone how to evaluate an expression given within a string, but rather the general flow of making an app. If you wanted to write your own library, you could do that by extracting each segment of the string. So for example, if you were given 5*((7-3) / 2) then you would possibly want to separate that string into the "7-3" segment, the "(7-3) / 2" segment, and finally the whole expression. For me, this screams recursion. Maybe you could write a recursive method that keeps evaluating whatever is in the inside of the parenthesis until there weren't any left (possibly a base case). I'm thinking of the factorial example. I want 5! but I need to know what 4! is but I need 3! and so on until I get to 1! = 1 and everything is based back. You could probably do something like that. So, in the example, we would get to the "7-3" and return 4. Then the previous stack could evaluate its expression (since we gave it the "(7-3) / 2" segment and now it knows what (7-3) is) and keep going that way. But I think you can see that this is slowly starting to get a little too complex for an intro to app development video
@PracticalCoding
@PracticalCoding 2 жыл бұрын
You know I never really thought about making my own parser but it would be kinda cool to try it out. I have an 8-hour car ride coming up. Maybe I'll try it out while I'm in the car
@todoentecnologiayt
@todoentecnologiayt 2 жыл бұрын
@@PracticalCoding I'd found it very useful. I hope you upload a video about it. Cheers!
@GTmotions
@GTmotions 3 жыл бұрын
Heyy my android studio keeps telling me that gradle could not be installed, how do I fix it?? Pls help
@heart_status26
@heart_status26 3 жыл бұрын
Same problem
@tales-t
@tales-t 3 жыл бұрын
I'm having following error and my backspace button isn't working. E:\BCS\Semester 7\HCI\Lab\Scalc\app\src\main es\drawable\backspace.xml:3: AAPT: error: attribute android:length not found.
@tales-t
@tales-t 3 жыл бұрын
> Task :app:processDebugResources AGPBI: {"kind":"error","text":"Android resource linking failed","sources" > Task :app:processDebugResources FAILED
@PracticalCoding
@PracticalCoding 3 жыл бұрын
That's because there's no length attribute for the drawable we're creating. You should have this in your backspace XML file
@tales-t
@tales-t 3 жыл бұрын
@@PracticalCoding Thanks
@samuelefendipurba6314
@samuelefendipurba6314 3 жыл бұрын
Thanks brotha
@PracticalCoding
@PracticalCoding 3 жыл бұрын
No Problem
@farihafaiz9474
@farihafaiz9474 Жыл бұрын
I am facing 1 error 🥺
@bangi288
@bangi288 2 жыл бұрын
"Transform's input file does not exist" error. Please help
@PracticalCoding
@PracticalCoding 2 жыл бұрын
Hey! Either the library was installed incorrectly or the wrong JDK file was used. This one is a little hard to debug so I would try removing the library from the project and then reinstalling
@bangi288
@bangi288 2 жыл бұрын
@@PracticalCoding I'm on Mac running JDK 16. How do I get the equals button to work?
@PracticalCoding
@PracticalCoding 2 жыл бұрын
@@bangi288 Unfortunately, mXparser doesn't support all of the JDKs (I think jdk 16 is one of them). What I've always had people try in the past is using whatever version I used in the video. I know I didn't match the JDK on my system (even though you probably should) and it still worked. I've seen a few people have luck with JDK 8 and 11. I'd try those out to see if they end up working. If you can't get one to work, then you'll have to use a JDK that's supported by mXparser
@wagnergauer9133
@wagnergauer9133 3 жыл бұрын
20:00 I am an absolute beginner , that's the first time that I heard of it. Do you have any tutorial of what I must do now?
@PracticalCoding
@PracticalCoding 3 жыл бұрын
Are you trying to figure out what jdk you have?
@fadoodlerpro7843
@fadoodlerpro7843 2 жыл бұрын
when I type in setSelection, there is no short cut that pops up, it either tries to choose setSelected or SetCustomSelection
@PracticalCoding
@PracticalCoding 2 жыл бұрын
You know someone on the Discord server just asked this yesterday I think. I'm not sure if it was you or not but just in case it wasn't (or if someone else has this issue in the future) make sure that you have an EditText for your display and in the java code, make sure the display variable is of type EditText
@fadoodlerpro7843
@fadoodlerpro7843 2 жыл бұрын
@@PracticalCoding It was me lol. thank you for the help I finished my app last Friday :) I figured out how to implement google maps and the swipe gesture too
@PracticalCoding
@PracticalCoding 2 жыл бұрын
@@fadoodlerpro7843 That's great to hear!
@jasminechourasiya3199
@jasminechourasiya3199 3 жыл бұрын
While running the program after zeroBTNPush I m getting an error saying: 'parent' is incompatible with attribute layout_constraintHorizontal_bias (attr) float. How should I resolve it ?
@PracticalCoding
@PracticalCoding 3 жыл бұрын
Hey! could you join the Discord server and post a picture or video of what's happening. It's always easier to help people out when I can see what Android Studio is doing Here's the link to the server: discord.gg/evK6jwg4Xj (If you don't have Discord just let me know)
@jasminechourasiya3199
@jasminechourasiya3199 3 жыл бұрын
@@PracticalCoding Stuck with a new error !! I have JDK 15,and other files from mxparser are not working for it .. Any alternatives ? And thanks for reply 😁. I have never much a good response. Keep the good work going.🙏 We need mentors like u.
@PracticalCoding
@PracticalCoding 3 жыл бұрын
@@jasminechourasiya3199 I would try using the jdk 8 file and if that doesn't work you'll have to use an older version of java if you want to use mXparser. A lot of people I see running into this problem end up finding a mXparser file that works. I know in the Discord server I made for this channel someone used the jdk 11 or 13 file and got it working. So maybe try a few files before considering using an older jdk on you system
@pixieland6079
@pixieland6079 3 жыл бұрын
Heyy sir plzz ans me i have issue in mainactivity.java clearBTNPush strToAdd is not working its givijh me an error plz help me
@PracticalCoding
@PracticalCoding 3 жыл бұрын
Yeah, I can help you out. Can you put the code you're using for the strToAdd and the claerBTNPush in a comment so I can take a look at it?
@pixieland6079
@pixieland6079 3 жыл бұрын
@@PracticalCoding can we talk personelly in your email or anyother communication media plzzz bcz i cant send u here
@PracticalCoding
@PracticalCoding 3 жыл бұрын
@@pixieland6079 You can join this channel's discord server if you want. Here's the link to that: discord.gg/evK6jwg4Xj I'm usually always on.
@pixieland6079
@pixieland6079 3 жыл бұрын
I have to submit it tomorrow plz plz rply me
@OnePiece-mc2pt
@OnePiece-mc2pt 2 жыл бұрын
Java or kotlin ?
@PracticalCoding
@PracticalCoding 2 жыл бұрын
This is all in Java
@JigneshPithia
@JigneshPithia 3 жыл бұрын
hi, i am stuck, when i run the app after zero button push. using android studio 4.1.3
@PracticalCoding
@PracticalCoding 3 жыл бұрын
It looks like Android Studio can't find the drawable resource for dmas_button_background. I'd make sure there isn't a typo somewhere or the name didn't get changed somehow
@JigneshPithia
@JigneshPithia 3 жыл бұрын
@@PracticalCoding i restarted the Android Studio, and the drawlable error went away. but there were some other error, like "In DataSet 'main', no data file for changedFile". but i pressed the play button again, and now the build is successful. but now on the emulator phone, when i open the calculator, it gives error, "Calculator keeps stopping". and it keeps crashing
@JigneshPithia
@JigneshPithia 3 жыл бұрын
ok. now i have removed everything from the java file, and run the app, so this is the first time the calucator got displayed on the emulator phone. i will try to code the java again, and see if it works or crashes.
@JigneshPithia
@JigneshPithia 3 жыл бұрын
so i re-typed my java, and even restarted Android studio, but same. app is stopping and crashing.
@JigneshPithia
@JigneshPithia 3 жыл бұрын
@@PracticalCoding hi, can you please help me. i am stuck at the java programming. as soon as i add something to Java, the app start crashing/stopping. i cant even view the app. here is the java code below.
@abulkalam6693
@abulkalam6693 2 жыл бұрын
8:40
@jonditsveniashvili8319
@jonditsveniashvili8319 3 жыл бұрын
Great tutorial very detailed explanation thnx from Georgia. Like and subscribe from me Keep going
@PracticalCoding
@PracticalCoding 3 жыл бұрын
Awesome, thank you!
@franky3728
@franky3728 3 жыл бұрын
Hey
@PracticalCoding
@PracticalCoding 3 жыл бұрын
I'm Back!
How to make a scientific calculator in Android Studio 2021 | Part 4
24:10
RecyclerView | Everything You Need to Know
25:07
Practical Coding
Рет қаралды 133 М.
لااا! هذه البرتقالة مزعجة جدًا #قصير
00:15
One More Arabic
Рет қаралды 51 МЛН
OMG what happened??😳 filaretiki family✨ #social
01:00
Filaretiki
Рет қаралды 12 МЛН
Smart Sigma Kid #funny #sigma #comedy
00:40
CRAZY GREAPA
Рет қаралды 38 МЛН
Kind Waiter's Gesture to Homeless Boy #shorts
00:32
I migliori trucchetti di Fabiosa
Рет қаралды 10 МЛН
How to Build a Calculator with Jetpack Compose - Android Studio Tutorial
43:24
How to make a Calculator in Android Studio | 2024
21:24
Easy Tuto
Рет қаралды 253 М.
I forced EVERYONE to use Linux
22:59
NetworkChuck
Рет қаралды 396 М.
How to win a argument
9:28
ajaxkmr
Рет қаралды 464 М.
The perfect imperfection of Google's Material You
15:47
David Imel
Рет қаралды 431 М.
you need to build a RUST desktop app!!
27:21
Travis Media
Рет қаралды 303 М.
How to make a scientific calculator in Android Studio 2021 | Part 1
18:34
The Bingo Paradox: 3× more likely to win
30:15
Stand-up Maths
Рет қаралды 120 М.
The Truth About SIM Card Cloning
13:04
Janus Cycle
Рет қаралды 1,1 МЛН
How to make a scientific calculator in Android Studio 2021 | Part 2
17:58
小丑把天使丢游泳池里#short #angel #clown
0:15
Super Beauty team
Рет қаралды 41 МЛН
Gli occhiali da sole non mi hanno coperto! 😎
0:13
Senza Limiti
Рет қаралды 16 МЛН
BOM DIA COM ALEGRIA ELIS E ELOÁ #baby  #funnymeme #humormeme
0:16
Elis e Eloá
Рет қаралды 12 МЛН
Он исполнил свою детскую мечту...
0:20
MovieLuvsky
Рет қаралды 4,6 МЛН
Какое пирожное выбрать?
0:53
Люди.Идеи, общественная организация
Рет қаралды 6 МЛН
Слинг
0:31
Bukatara Official
Рет қаралды 2,4 МЛН