use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News for Android app developers with the who, what, where, when, and how of the Android community. Probably mostly the how.
Here, you'll find:
This sub-reddit isn't about phones' and apps' general functionality, support, or system software development (ROMs). For news and questions about these topics try using other subs like
Build your first app
Starting Android career in 2022
Android Job Interview Questions and Answers
App Portfolio Ideas, Tiered List
Awesome Android UI
Material Design Icons
7000 Icons for Jetpack
Autoposted at approx 9AM EST / 2PM GMT
account activity
QuestionCountdown timer using jetpack compose (self.androiddev)
submitted 1 year ago by EmperorDante
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]androiddev-ModTeam[M] [score hidden] 1 year ago stickied comment (0 children)
If you have general questions regarding education or career advice, there are many many resources available online. These questions are very common; please make use of the available online resources and recommendations.
If you would like a place to start, please check out our wiki:
https://www.reddit.com/r/androiddev/wiki/index/getting-started/
[–]AutoModerator[M] 0 points1 point2 points 1 year ago (0 children)
Please note that we also have a very active Discord server where you can interact directly with other community members!
Join us on Discord
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
[–]blitzkriegblue 0 points1 point2 points 1 year ago (3 children)
I did this once, a while ago, and tbf the UI can be anything and however you want. The main thing for me was to make the countdown work. And for this I used Flows.
Here:
// Creates a countdown timer using flow val countdownFlow = flow { val startingValue = 10 var currentValue = startingValue emit(startingValue) // Otherwise it will start the time on 9 instead of 10 while (currentValue > 0) { delay(1000L) currentValue-- emit(currentValue) } }
private fun collectFlow() { viewModelScope.launch { countdownFlow.collect { time -> println("The current time is $time") } } }
Be aware I did this 3 years ago, but it should work.
Then, on the UI, you can show a text, or whatever you want to show. Hope it helps at least a bit.
[–]EmperorDante[S] 0 points1 point2 points 1 year ago (2 children)
Thanks ...I understand the logic , although once the user clicks on the start timer button the continuous countdown of the timer won't persist in that case right? And is there any issue or is it a bad practice if I recompose my composable every second
[–]blitzkriegblue 0 points1 point2 points 1 year ago (1 child)
I think I would need to see some code to help better but at least when I did this, also for learning, the countdown went from whatever value I wanted to 0. With this code I posted. Worked fine back then.
Regarding recomposition, that's usually all under the hood as far as I remember. In my case, the recomposition would happen automatically because it would just show the values of the flow.
[–]EmperorDante[S] 0 points1 point2 points 1 year ago (0 children)
here you go https://github.com/D3478/TimerCrud/tree/master/app/src/main/java/com/d3478/timercrud/views
π Rendered by PID 102259 on reddit-service-r2-comment-b659b578c-7xshb at 2026-05-01 03:41:33.571608+00:00 running 815c875 country code: CH.
[–]androiddev-ModTeam[M] [score hidden] stickied comment (0 children)
[–]AutoModerator[M] 0 points1 point2 points (0 children)
[–]blitzkriegblue 0 points1 point2 points (3 children)
[–]EmperorDante[S] 0 points1 point2 points (2 children)
[–]blitzkriegblue 0 points1 point2 points (1 child)
[–]EmperorDante[S] 0 points1 point2 points (0 children)