HDTutorial
EN

Playback starts YouTube’s embedded player (privacy-enhanced mode).

How to Restore Variables When Rotating the Device - Android Studio Tutorial

72,290 views November 14, 2018 4:37

Watch on YouTube
ChannelCoding in Flow

Description from the creator

When there are runtime configuration changes in your Android phone, like changing the screen orientation or the device's language, your whole app process will be destroyed and recreated from scratch and together with it, all member variables will be reset. The system already takes care of default views like the text in an EditText field or the scrolling position of a RecyclerView or ListView. But we have to restore the variables of our activity ourselves and we do this by overriding onSaveInstanceState and passing the values to the outState Bundle. After the Activity has been recreated, there are 2 places where we can get our values back: onCreate or onRestoreInstanceState, which both get passed the savedInstanceState Bundle.

Source Code:
gist.github.com/codinginflow/16b73c12aca3c3cf3d…

____________________
💻 Find the BEST programming tutorials on TutHub:
tuthub.io

⭐ Get my MVVM Caching Course now:
codinginflow.com/caching

❗ Subscribe to the channel:
youtube.com/c/codinginflo...

📨 Subscribe to the Coding in Flow newsletter:
codinginflow.com/newsletter

❓ Join our free developer community:
discord.gg/TSnMvmc

📣 Follow Coding in Flow on other sites:
Facebook: facebook.com/codinginflow
Instagram: instagram.com/codinginflow
TikTok: tiktok.com/@codinginflow
Twitter: twitter.com/codinginflow
Github: github.com/codinginflow

💰 Business requests, sponsoring, etc.: [email protected]

About this tutorial

Coding in Flow published this 4:37 video tutorial on November 14, 2018. It has been watched 72,290 times on YouTube.

Duration
4:37
Published
November 14, 2018
Views
72,290
Likes
1,571

Tags

Share

This tutorial in other languages