Countdown Timer Part 2 – ORIENTATION CHANGES – Android Studio Tutorial
A lot of you have watched my CountDownTimer tutorial and noticed, that our timer stops and resets when we rotate the device. This is because our activity gets destroyed and restarted by the system when there are runtime configuration changes like a screen rotation (or changing the system’s language).
In this video we will learn, how to restore our CountDownTimer on orientation changes and keep it running seamlessly. For this we will override onSaveInstanceState and onRestoreInstanceState to save our values in the outsate and restore them in the savedInstanceState Bundle.
Watch the whole playlist:
Code for this part:
https://gist.github.com/codinginflow/7d5639e881495f3bda60241487d5761b
____________________
💻 Find the BEST programming tutorials on TutHub:
https://tuthub.io
⭐ Get my MVVM Caching Course now:
https://codinginflow.com/caching
❗ Subscribe to the channel:
https://www.youtube.com/c/codinginflo…
📨 Subscribe to the Coding in Flow newsletter:
https://codinginflow.com/newsletter
❓ Join our free developer community:
https://discord.gg/TSnMvmc
📣 Follow Coding in Flow on other sites:
Facebook: https://www.facebook.com/codinginflow
Instagram: https://www.instagram.com/codinginflow
TikTok: https://www.tiktok.com/@codinginflow
Twitter: https://twitter.com/codinginflow
Github: https://github.com/codinginflow
💰 Business requests, sponsoring, etc.: info@codinginflow.com
Views :25564
android studio