Count Up Timer App Android Studio Tutorial

  Рет қаралды 28,211

Code With Cal

Code With Cal

Күн бұрын

In todays tutorial I'm going to run you through how to build a simple count up timer app using Java and Android Studio. Our simple tutorial app will have a few basic buttons to start, stop and reset the timer. We will build and alert dialog to confirm when the timer is reset. Our basic timer will count up from zero to infinity and beyond 🚀🚀🚀.
Source Code:
github.com/codeWithCal/Timer.git
Swift Xcode Timer App Tutorial:
• Simple Timer App Swift...
⏱️TIMESTAMPS
00:00 - Intro
00:45 - UI Layouts
03:15 - Timer Code ⏱️
#AndroidStudio #TimerApp #Tutorial #AppDevelopment

Пікірлер: 72
@aledirksen01
@aledirksen01 3 жыл бұрын
This is exactly what I was looking for. An experienced coder to speed up my learning curve in android studio. I watched another tutorial and the guy never wrote a single line of code... I was sad and confused until I found your video. This shows exactly how an experienced coder would use android studio and I thank you. I am surprised this video barely has any views and likes and comments. I hope this blows up.
@CodeWithCal
@CodeWithCal 3 жыл бұрын
Thanks so much!
@woojuspace7281
@woojuspace7281 3 жыл бұрын
Mate! This is amazing! Thank you for the nice tutorial!!
@gamesetecnologiabr8475
@gamesetecnologiabr8475 2 жыл бұрын
Thank you, it was exactly what I was looking for.👍
@viswanath514
@viswanath514 2 жыл бұрын
Crisp and clear .. thank you .. 👌
@adrileysamuel4301
@adrileysamuel4301 3 жыл бұрын
Otimo vídeo. Continue trabalhando assim. S2
@MotoVlogists
@MotoVlogists Жыл бұрын
Good tutorial. Thanks! :)
@szymek16s
@szymek16s Жыл бұрын
Thank you so much ;)
@dilshodiskandarov7144
@dilshodiskandarov7144 3 жыл бұрын
Rahmat sizga ustoz !
@jackoblongata7270
@jackoblongata7270 3 жыл бұрын
This is great, would love a follow-up where you show how to let the app run in the background even if we switch to another app or close the app.
@CodeWithCal
@CodeWithCal 3 жыл бұрын
Great idea, thanks.
@parsaoli5714
@parsaoli5714 2 жыл бұрын
it was vert helpful!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! thank you
@Caovannguyen
@Caovannguyen 11 ай бұрын
thanks for sharing
@bansalinstrumentation9352
@bansalinstrumentation9352 Жыл бұрын
Thanks
@techelavate7152
@techelavate7152 3 жыл бұрын
Keep going
@khiemcho3818
@khiemcho3818 10 ай бұрын
usefull
@amineiguider9480
@amineiguider9480 3 жыл бұрын
Good job , keep going
@CodeWithCal
@CodeWithCal 3 жыл бұрын
Thanks
@akkrapholpipathworapoom3788
@akkrapholpipathworapoom3788 2 жыл бұрын
Very good Code
@FathurRoziq12
@FathurRoziq12 2 жыл бұрын
what if I want the number to be reduced instead of adding to it?
@luoyui3068
@luoyui3068 3 жыл бұрын
tq
@GamerM2M
@GamerM2M 2 жыл бұрын
Thank you alot for this tutorial but i was wondering how can i return the time after the timer stop as integer so i can use it for another calculations?
@CodeWithCal
@CodeWithCal 2 жыл бұрын
We keep the time as the double variable. So you can return that. Just cast it to an int like we do in getTimerText()
@ihebmiled7263
@ihebmiled7263 3 жыл бұрын
Good job
@CodeWithCal
@CodeWithCal 3 жыл бұрын
Thanks 👍
@Acecryz
@Acecryz Жыл бұрын
How do I start the timer in a new activity? After clicking a button?
@cisco26614
@cisco26614 2 жыл бұрын
If i want only seconds to show counting it only goes uptp 60 and gets reset, but i want it to continue further 60 as well, how can i do that...plz help P.S. I have used same code and just removed hours and minute parameters
@rubinho388
@rubinho388 2 жыл бұрын
5:45 how did you choose these values 86400, 3600 and 60? I understood the result but I dont know the logic behind those numbers...Is this some sort of formula for getting seconds, minutes and hours and then resetting it when it gets at a limit value?
@CodeWithCal
@CodeWithCal 2 жыл бұрын
Yeah so that value is total milliseconds and those numbers calculate the hours seconds etc from the milliseconds
@maryannadelman4438
@maryannadelman4438 Жыл бұрын
What code snippet would need to be added to stop the timer at 15 minutes?
@CodeWithCal
@CodeWithCal Жыл бұрын
if(time == (15 Minutes in milliseconds)) { stopTimer() }
@maryannadelman4438
@maryannadelman4438 Жыл бұрын
@@CodeWithCal Thanks!!
@lglf77
@lglf77 2 жыл бұрын
You had a class where the timer didn't stop even when the user turned off the smartphone, I can't find this class in your video collections. Can you repeat the class? I'm new to JAVA, I need to understand java a lot and it takes months even years, I can't want to like KOTLIN right now.
@ChrisChanSajelan
@ChrisChanSajelan 3 жыл бұрын
How do you start the count up from a given time?
@CodeWithCal
@CodeWithCal 3 жыл бұрын
You should be able to set the variable: Double time = 0.0; To your given custom start time.
@pltsm3970
@pltsm3970 3 жыл бұрын
This is great, but one issue when screen rotate or app is closed, timer start reset automatically and start from 0.
@CodeWithCal
@CodeWithCal 3 жыл бұрын
You are right, for simplicity sake the timer is running on the main / UI thread. Putting the timer on a background thread is the way forward. Maybe a tutorial on the topic would be good 🤔
@pltsm3970
@pltsm3970 3 жыл бұрын
@@CodeWithCal i am a new coding learner, if you do a great tutorial like before that would be great.
@MisterBoZiffer
@MisterBoZiffer 3 жыл бұрын
I have to watch this in slow motion to even remotely understand what's happening.
@kavyahiremath8805
@kavyahiremath8805 3 жыл бұрын
when closing app time reset. how can we save last time before close app ???
@CodeWithCal
@CodeWithCal 3 жыл бұрын
Sqlite would be one option. Shared preferences would be another. Both would make for good tutorials. I will put on the to do list.
@geezeerr1404
@geezeerr1404 3 жыл бұрын
@@CodeWithCalHey Cal, are you already make this tutorial? 😃
@CodeWithCal
@CodeWithCal 3 жыл бұрын
Both 😉☺️
@androider5830
@androider5830 3 жыл бұрын
sir how can i showing timer out of app, like when i close my app 1min timer showing like as a toast message or others
@CodeWithCal
@CodeWithCal 3 жыл бұрын
I would suggest putting the timer into a push notification if you need to show it outside of your app. 👍
@androider5830
@androider5830 3 жыл бұрын
@@CodeWithCal like a 1 min toast message is not possible?
@CodeWithCal
@CodeWithCal 3 жыл бұрын
www.codeproject.com/articles/988256/how-to-show-a-toast-for-a-specific-duration-in-and#:~:text=There%20is%20no%20way%20to,which%20to%20display%20a%20toast. Not impossible, but not completely straight forward. I have attached a link which could shed some light.
@androider5830
@androider5830 3 жыл бұрын
@@CodeWithCal i try this code now then reply you what is going on
@androider5830
@androider5830 3 жыл бұрын
Sir this code is working when i press a button but i want to do that after closing app 1 min toast message showing, In this case which method is needed like onStop or others method or something
@thevoiceofdarkness7655
@thevoiceofdarkness7655 3 жыл бұрын
I'm trying to use a timer to draw on a canvas, but the function gets stuck. Any ideas?
@CodeWithCal
@CodeWithCal 3 жыл бұрын
What do you mean by draw on a canvas? And how is it getting stuck?
@thevoiceofdarkness7655
@thevoiceofdarkness7655 3 жыл бұрын
@@CodeWithCal I have a canvas, and it's suppose to draw vertical lines at a specific interval when I hit a button, but it doesn't. If I hit the button again, however, all the lines which should have been drawn given the time elapsed appear at once.
@CodeWithCal
@CodeWithCal 3 жыл бұрын
Hmm 🤔 the view should auto refresh. By the sounds of it. Have you used break points before? I would add a break point. And step through.
@thevoiceofdarkness7655
@thevoiceofdarkness7655 3 жыл бұрын
@@CodeWithCal I'll give that a look. Thanks!
@woojuspace7281
@woojuspace7281 3 жыл бұрын
I found a serious error. If you turn vertical to horizontal or opposite, the timer resets to 0 automatically. Can you provide the code to fix it? Thanks
@woojuspace7281
@woojuspace7281 3 жыл бұрын
Oh didn't know when rotate, data is reset. I solve the problem with this at Manifest. Thanks
@CodeWithCal
@CodeWithCal 3 жыл бұрын
You can also set an activity to never rotate if it makes sense with in your app. :)
@woojuspace7281
@woojuspace7281 3 жыл бұрын
@@CodeWithCal Thanks! :)
@zainnn84991
@zainnn84991 2 жыл бұрын
You still Java to write Android code and not Kotlin? And then put all the logic in your Activity? In the year 2020? :| #BadExampleToFollow
@CodeWithCal
@CodeWithCal 2 жыл бұрын
Firstly Java still has it's place. Secondly this is a small project and tutorial so who cares where the code is. You are right, for bigger projects it is worth splitting most logic out of your activity. But man I'm calling you out for sounding like a massive elitist.
@DTasmuk
@DTasmuk 2 жыл бұрын
Em. It's not a timer. It's a stopwatch.
@CodeWithCal
@CodeWithCal 2 жыл бұрын
🙃😆
@rajneeshroy4538
@rajneeshroy4538 2 жыл бұрын
It's okay making these timers,but actuall problem arises when you destroy the app it doesn't count . Therefore it's nothing . Waste of time 😎
@CodeWithCal
@CodeWithCal 2 жыл бұрын
😉 kzfaq.info/get/bejne/graam7NqqZnUnWw.html
@acerlmt
@acerlmt 4 ай бұрын
Thank you! But Tapped not working, so I add btn.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if(timerStarted == false){ timerStarted = true; btn.setText("Stop"); startTimer(); } else { timerStarted = false; btn.setText("Start"); timerTask.cancel(); } } });
Java vs Kotlin for Android App Development
8:23
Keep On Coding
Рет қаралды 248 М.
JPEG is Dying - And that's a bad thing
8:09
2kliksphilip
Рет қаралды 11 М.
Идеально повторил? Хотите вторую часть?
00:13
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 9 МЛН
Smart Sigma Kid #funny #sigma #comedy
00:40
CRAZY GREAPA
Рет қаралды 33 МЛН
Mom's Unique Approach to Teaching Kids Hygiene #shorts
00:16
Fabiosa Stories
Рет қаралды 38 МЛН
Encanto but it's awkward
9:06
Kadz
Рет қаралды 13 МЛН
How to make a Calculator in Android Studio | 2024
21:24
Easy Tuto
Рет қаралды 251 М.
THIS Is How You Schedule Alarms on Android with AlarmManager
21:55
Philipp Lackner
Рет қаралды 37 М.
RecyclerView Item Click | Best Practice Way
8:06
Practical Coding
Рет қаралды 93 М.
List View App Android Studio Tutorial Using Custom Adapter
16:31
Code With Cal
Рет қаралды 11 М.
Pop Up Date Picker Android Studio Tutorial
5:39
Code With Cal
Рет қаралды 73 М.
Идеально повторил? Хотите вторую часть?
00:13
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 9 МЛН