Calculator App Android Studio Kotlin Tutorial

  Рет қаралды 72,950

Code With Cal

Code With Cal

Күн бұрын

How to create a simple calculator app using Android Studio and Kotlin. A great beginner programming project. In this example Android app we build a basic calculator from scratch, meaning that no external or 3rd party libraries are used.
In the first part of the tutorial we build a calculator grid layout using constraint view, linear layout and buttons. We also use styles to make managing the layout easier, if changes are required in the future.
In the second part of the tutorial we connect our buttons as well as implement all of the logic for our calculator be able to add, subtract, divide and multiply.
Calculator Source Code:
github.com/codeWithCal/Kotlin...
Java Android Studio Calculator:
• Calculator App Example...
⏱️ TIMESTAMPS ⏱️
00:00 - Intro
00:47 - Colors Themes
01:28 - Workings XML
02:30 - Calculator Grid XML
05:26 - Build Gradle
05:37 - Workings Kotlin
07:23 - Calculate Results Kotlin
11:43 - Calculator Test
#CalendarAppTutorial #LearnAndroidStudio #AppDevelopment

Пікірлер: 123
@wendiiyau
@wendiiyau 2 жыл бұрын
⌫ 5:02 This is the symbol he uses, just copy paste it~
@sushantchoudhary444
@sushantchoudhary444 Жыл бұрын
thanks bro you saved me
@filipecomimesmo
@filipecomimesmo Жыл бұрын
for those searching for it, the name of the symbol is "erase to the left".
@asmaatharwt5209
@asmaatharwt5209 Жыл бұрын
you can get it from vector resource its name is"backspace" and treat with butten as imageButton
@user-qg5tm3in8l
@user-qg5tm3in8l 3 ай бұрын
Thanks bro, you helped me!
@satyamsharma8240
@satyamsharma8240 3 жыл бұрын
Slow it for us small people
@McDonaldsFlagatHalfMast
@McDonaldsFlagatHalfMast 10 ай бұрын
You made this tutorial AN ENTIRE 9 MONTHS after it was announced that the Android Kotlin Extensions Gradle plugin was no longer going to be supported?
@hamzaakgun5527
@hamzaakgun5527 Жыл бұрын
Honestly I loved the way you approached it and learned a lot from this video, even though it's not a long one.
@CodeWithCal
@CodeWithCal Жыл бұрын
Thanks a lot, really kind of you to say :)
@AdishaFdo
@AdishaFdo 2 жыл бұрын
Thank you! Was very helpful!
@pradipbarvaliya9947
@pradipbarvaliya9947 2 жыл бұрын
awesome explanation and development thank you Cal
@Leeminduc
@Leeminduc 2 жыл бұрын
Thank Cal, this video help so much !
@alanromero8018
@alanromero8018 2 жыл бұрын
Buen video!! buenisimo!! saludos desde Argentina. Nuevo Sub :)
@wiki-SMART
@wiki-SMART 2 жыл бұрын
I love you!.. Great work!.. Thank you!
@emilianomartinezpena5420
@emilianomartinezpena5420 2 жыл бұрын
Gracias este video es asombroso
@abeer7373
@abeer7373 2 жыл бұрын
Thaaank you You're a lifesaver..!
@bramantawisnu
@bramantawisnu 2 жыл бұрын
i use 0.25 speed ,, becouse that very fast,, like magic tric 😁
@CodeWithCal
@CodeWithCal 2 жыл бұрын
🪄
@p.soumyasundarsubudhi6007
@p.soumyasundarsubudhi6007 8 ай бұрын
Thanks for the tutorial it helped me
@theblueplanet3576
@theblueplanet3576 3 ай бұрын
My takeaway from this video was using of styles. Thanks 🙏
@HugoLopezDev
@HugoLopezDev 2 жыл бұрын
Thanks for teaching this. New subscriber
@salomeshunamon4737
@salomeshunamon4737 4 ай бұрын
kotlin-android-extensions is depreciated. Can you make an update video with how to change this finished project so that it's compatible?
@chocolatelover326
@chocolatelover326 2 ай бұрын
Exactly bcz of translation it get hide...
@explainer7018
@explainer7018 Жыл бұрын
great video Cal...
@groverkennedy2049
@groverkennedy2049 2 жыл бұрын
Thanks a lot my dude
@gauravmalik9c867
@gauravmalik9c867 3 жыл бұрын
Love you bro
@aymanachalhe9136
@aymanachalhe9136 2 жыл бұрын
good work!
@morfeoraikonen
@morfeoraikonen 2 жыл бұрын
Great video keep it going , new subscribe right here :D
@CodeWithCal
@CodeWithCal 2 жыл бұрын
Thanks 😊
@delirarian3388
@delirarian3388 3 жыл бұрын
It was very useful
@reniac3128
@reniac3128 Жыл бұрын
What do I do?
@omerbabo
@omerbabo Жыл бұрын
Thank you brother
@wendiiyau
@wendiiyau 2 жыл бұрын
Hey Cal, if we can't use this anymore apply plugin: 'kotlin-android-extentions' then what should I do for the program to run?
@CodeWithCal
@CodeWithCal 2 жыл бұрын
The way google would like us to do it now is with view binding :)
@p.soumyasundarsubudhi6007
@p.soumyasundarsubudhi6007 8 ай бұрын
Can I know how to add the modulo operations in the existing code given by you
@tafman
@tafman 2 жыл бұрын
Nice tutorial, we really appreciate for your time making videos like this, it's really helping people like us who are new to coding... 5:02 how/where did you get that button from because it's not on my keyboard?
@rishabnegi2334
@rishabnegi2334 2 жыл бұрын
i also have same doubt. How you are able to enter that button
@tafman
@tafman 2 жыл бұрын
@@rishabnegi2334 Found the solution... Its a code that you'll enter in the space given there
@CodeWithCal
@CodeWithCal 2 жыл бұрын
I just copied the character from the internet ;)
@elnino9139
@elnino9139 Жыл бұрын
Plugin with id 'kotlin-androids-extensions' not found.
@meebolover1777
@meebolover1777 2 жыл бұрын
My buttons are not calling the the style variables. They are just remaining default
@Alvarez_Isaac
@Alvarez_Isaac 3 ай бұрын
Hey Cal, first of all. Thanks for your code and knowledge, it's been so helpful. I have a question about your code, I noticed that if you put the negative value first, it won't do the operation. For example: -99 + 1 and if you click the equal button, there will be no operation or just -1 and equal button, error too. Could you please give me some advice to fix this? Thanks anyway for your solution
@vascocastel-branco3370
@vascocastel-branco3370 Жыл бұрын
hey, awesome video, but when you used the (" apply plugin: 'kotlin-android-extensions' ") it says it is no longer supported, what should I do to fix this? Thank you very much!!
@ashfaqueshaikh4177
@ashfaqueshaikh4177 Жыл бұрын
U can use view binding
@junekang3168
@junekang3168 2 жыл бұрын
Great work!
@priyanshushrivastava4453
@priyanshushrivastava4453 2 жыл бұрын
sir i cant able to access workingsTV directly in main activity what is the solution sir?
@kgomotso_nxumalo
@kgomotso_nxumalo Жыл бұрын
same
@RaneemSarminy
@RaneemSarminy 2 ай бұрын
I named the file with the same file name and copied the code. I did not write it myself, but there are a lot of errors. Does anyone know the reason? error in workingsTV. There are yet other errors.
@johns.5298
@johns.5298 2 жыл бұрын
1:46 what did you do after saying 20dp? It’s like a star symbol and then it gets copied below
@johns.5298
@johns.5298 2 жыл бұрын
I got it lol. It’s not a star symbol
@CodeWithCal
@CodeWithCal 2 жыл бұрын
🥳
@thehackerstnt2147
@thehackerstnt2147 Жыл бұрын
Man that was tooooooooooooooooooooooooo fast 😳
@tnt_popcorn__
@tnt_popcorn__ 8 ай бұрын
I did the view binding but still not working. I almost give up
@AYJ959
@AYJ959 Жыл бұрын
after pressing backspace button its not working properly
@AyushRaj-ml5nf
@AyushRaj-ml5nf Жыл бұрын
if ( timesDivision.isEmpty() ) return"" can anyone please explain why this line is written ??
@miracleukaka4085
@miracleukaka4085 Жыл бұрын
If the list returned by the timeDivide function is empty, we want the function that called it to return an empty string to the result.
@purvpatel8124
@purvpatel8124 2 жыл бұрын
how to code for +/- sign can you please give any code for it I tried it but my functionality didn't work
@CodeWithCal
@CodeWithCal 2 жыл бұрын
I don't have any code as of right now. But definitely possible good luck
@robinkalostyan4728
@robinkalostyan4728 2 жыл бұрын
i got a fail to compile values file error what should ı do?
@CodeWithCal
@CodeWithCal 2 жыл бұрын
Hmm what does Google say with that error 🤔
@heriwijaya588
@heriwijaya588 2 жыл бұрын
Im learning the android right now , but when I added the kotlin android extension, it shows errors that says the extentions not found. anyone can help me?
@CodeWithCal
@CodeWithCal Жыл бұрын
View Bindings are the way to go now developer.android.com/topic/libraries/view-binding
@heriwijaya588
@heriwijaya588 Жыл бұрын
@@CodeWithCal thanks a lot .
@SumoPixelPlay
@SumoPixelPlay Жыл бұрын
Bro I make caculeter o m g thanks you
@muhammadmohsinnaeem8402
@muhammadmohsinnaeem8402 Жыл бұрын
workingTv is nnot funtional in my program
@vascocastel-branco3370
@vascocastel-branco3370 Жыл бұрын
you have to create a variabel like this " name_of_variable = findViewById(R.id.name_of_textview) " (inside onCreate) and than " private lateinit var workingsTV: TextView " (above and outside onCreate)
@calibur5518
@calibur5518 2 жыл бұрын
hi how i can change my out put from 160000.0 to 16,000
@CodeWithCal
@CodeWithCal 2 жыл бұрын
Replace result.toString With a check to remove decimal place if not necessary, you could use a string formatter or round the float. discuss.kotlinlang.org/t/how-do-you-round-a-number-to-n-decimal-places/8843
@calibur5518
@calibur5518 2 жыл бұрын
@@CodeWithCal thank you so much
@etokamo
@etokamo 2 жыл бұрын
7:05 small bug, forgot to tab canAddOperator=true, because otherwise there can be a problem with . and /
@omur.bilgili
@omur.bilgili 2 жыл бұрын
it have some bugs, but its nice
@preetthee
@preetthee 2 жыл бұрын
The kotlin extensions plugins not working. it's saying that "the 'kotlin-android-extensions' gradle plugin is deprecated"
@CodeWithCal
@CodeWithCal 2 жыл бұрын
Ah yes, I built this tutorial using synthetics, when the new way is view bindings. Have you used view bindings before?
@preetthee
@preetthee 2 жыл бұрын
Thanks. I got it now.
@anubhavbagri5204
@anubhavbagri5204 2 жыл бұрын
@@preetthee Could you share your github code repo link? its not working for me as well. And since I'm new, I'm unable to figure out how to use view bindings
@bryansantana1212
@bryansantana1212 11 ай бұрын
@@CodeWithCal Hey Cal, I know this is old but can you explain how to use view bindings? I tried to google it, but the tutorial I am using is not breaking it down easily. If you know of a good tutorial out there, that would work.
@tknsoftwarestudio640
@tknsoftwarestudio640 2 жыл бұрын
How can I add the parentheses?
@CodeWithCal
@CodeWithCal 2 жыл бұрын
Probably a bit complicated for a KZfaq comment. I have been thinking if doing a part 2 of this tutorial. If I do I'll be sure to include. It is possible good luck 🍀
@tknsoftwarestudio640
@tknsoftwarestudio640 2 жыл бұрын
Thanks I'm looking forward to it.
@lokesharora4037
@lokesharora4037 2 жыл бұрын
why you use light theme
@CodeWithCal
@CodeWithCal 2 жыл бұрын
I use both sometimes, doesn't really bother me either way
@aanjaliiii
@aanjaliiii 3 жыл бұрын
hi it was awesome my division and multiply is not working
@CodeWithCal
@CodeWithCal 3 жыл бұрын
🤔 entirely possible I've overlooked something. What have you found?
@aanjaliiii
@aanjaliiii 3 жыл бұрын
@@CodeWithCal I am new to this, I just followed your code but my divide and multiplication button is not working
@CodeWithCal
@CodeWithCal 3 жыл бұрын
​@@aanjaliiii Programming can be tricky business. And things don't necessarily always work the first time. But don't be discouraged keep trying and you will get there. Try to understand why the multiplication and division isn't working and then if you are still stuck ask a specific question. General statements like it doesn't work makes it very difficult for me or anyone else to help with the problem. Apologies if thats a little blunt.
@aanjaliiii
@aanjaliiii 3 жыл бұрын
@@CodeWithCal it's ok.. I get your point
@umarajmal6216
@umarajmal6216 2 жыл бұрын
whenever i press on any operator my app automatically ends .?.?.?
@CodeWithCal
@CodeWithCal 2 жыл бұрын
What does it say in your console. Googling the exception is usually a good first step
@umarajmal6216
@umarajmal6216 2 жыл бұрын
@@CodeWithCal it’s throwing a null exception
@CodeWithCal
@CodeWithCal 2 жыл бұрын
Nice. So trace back why it's null. Or make it null safe?
@user-wm9qo9oc2w
@user-wm9qo9oc2w 2 жыл бұрын
すごい
@CodeWithCal
@CodeWithCal 2 жыл бұрын
ありがとうございます
@frankndyanabo6047
@frankndyanabo6047 2 жыл бұрын
mine remained orange throught all the buttons
@CodeWithCal
@CodeWithCal 2 жыл бұрын
Should just be a change in the XML somewhere to change some buttons to be white
@michaelbreezywilberforce2646
@michaelbreezywilberforce2646 Жыл бұрын
Nice video but it was fast
@mr_waras
@mr_waras Жыл бұрын
wowowow slow down man, boom bam bam done, I do know java, but not kotlin and not android studio ui, but it's abit too fast, unless you pause every second :D
@darrenmendez7262
@darrenmendez7262 Жыл бұрын
pls add modulo
@lordcinder
@lordcinder Жыл бұрын
Play this at .75x speed. Your welcome
@CodeWithCal
@CodeWithCal Жыл бұрын
😂
@user-fj1bw7qg8i
@user-fj1bw7qg8i 6 ай бұрын
4:30
@usaakshayadhana3149
@usaakshayadhana3149 Жыл бұрын
Explain things in much more details. I think it is not for absolute beginners.
@CodeWithCal
@CodeWithCal Жыл бұрын
😋
@IslamicAuliyaLife
@IslamicAuliyaLife 2 жыл бұрын
Please give me , sorscod calculator
@CodeWithCal
@CodeWithCal 2 жыл бұрын
Link in description ☝️
@coltsfancolts
@coltsfancolts Жыл бұрын
Way too fast
@manuelmuni2403
@manuelmuni2403 2 жыл бұрын
Troppo veloce
@shohruzbek
@shohruzbek 4 ай бұрын
very fast ((((
@rutgerpronk2754
@rutgerpronk2754 10 ай бұрын
Bro were not coding with cal you are coding we are copying. i dont like ur super fast phase video's
@rutgerpronk2754
@rutgerpronk2754 10 ай бұрын
You are coding so fast i have you on 0.75 speed and its so frustrating to watch because i cant even keep up hard to even read the colors when you enterd them and dont even explain anything.
@user-mh1km3mv7z
@user-mh1km3mv7z 5 ай бұрын
jesus christ slow down pausing and playing your video is kinda defeating the purpose. why dont you make a write up?
@kgomotso_nxumalo
@kgomotso_nxumalo Жыл бұрын
idk if you'll see this now but can i get help on kt. page. for some reason workingsTV and resultsTV are in red?
@vascocastel-branco3370
@vascocastel-branco3370 Жыл бұрын
you have to create a variabel like this " name_of_variable = findViewById(R.id.name_of_textview) " (inside onCreate) and than " private lateinit var workingsTV: TextView " (above and outside onCreate)
@micahellis9598
@micahellis9598 7 ай бұрын
@@vascocastel-branco3370 THANK YOU!! this is the answer
How to Build a Calculator with Jetpack Compose - Android Studio Tutorial
43:24
Learn Kotlin in 12 Minutes
12:01
Rahul Pandey
Рет қаралды 313 М.
When You Get Ran Over By A Car...
00:15
Jojo Sim
Рет қаралды 24 МЛН
Wait for the last one! 👀
00:28
Josh Horton
Рет қаралды 163 МЛН
HOW DID HE WIN? 😱
00:33
Topper Guild
Рет қаралды 40 МЛН
StopWatch Timer on Service Android Studio Kotlin Tutorial
8:37
Code With Cal
Рет қаралды 26 М.
Tic Tac Toe Android Studio Kotlin Tutorial | Noughts & Crosses
9:47
Creating Simple Calculator App in Android Studio using Kotlin
22:07
Coding for Mobile
Рет қаралды 41 М.
CardView in RecyclerView Android Studio Kotlin Tutorial
10:04
Code With Cal
Рет қаралды 20 М.
How to create calculator using Android Studio - Kotlin
13:34
CodeAndroid
Рет қаралды 89 М.
KMP vs. Flutter - Who Will Win The Cross-Platform Battle?
16:19
Philipp Lackner
Рет қаралды 34 М.
When You Get Ran Over By A Car...
00:15
Jojo Sim
Рет қаралды 24 МЛН