What does Java – (savedinstancestate) mean
•
Java
There are some codes in my main activities
if (savedInstanceState != null) { mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION); mFromSavedInstanceState = true;
I don't quite understand the meaning of (savedinstancestate) in this code Someone can tell me what it means in this case, because I'm a bit like a rookie. I want to know the code so that I can learn it, understand it, and even copy it when necessary
Solution
Quoted from( http://developer.android.com/training/basics/activity-lifecycle/recreating.html ):
In addition, if you save the state of the application in a package (usually non persistent dynamic data in onsaveinstancestate), if you need to recreate the activity (for example, direction change), you can pass it back to oncreate so that you won't lose this previous information Savedinstancestate is null if no data is provided
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码