Home > DeveloperSection > Forums > How to get boolean from savedInstancestate on orientatioin change
Hugh Jackman
Hugh Jackman

Total Post:52

Posted on    February-03-2015 10:53 PM

 Mobile Development Android  Android Activity 

 1 Reply(s)
 523  View(s)
Rate this:

I want to save some boolean variables in Bundle i.e savedInstaceState those i can use after orientation changed .

I tried but always the savedInstanceState result in null


 savedInstanceState=new Bundle();




please provide the better way thanks .

Norman Reedus
Norman Reedus

Total Post:45

Posted on    February-03-2015 11:23 PM

Which method are you calling that logic?

I am guessing that is in onCreate(), onCreate is where you LOAD the savedInstanceState, it is NOT where you SAVE your data. (you can also load it in onRestoreInstanceState)

You want to save your data in public void onSaveInstanceState(Bundle savedInstanceState) {


 public void onSaveInstanceState(Bundle savedInstanceState) {


     savedInstanceState.putBoolean("isLogoLoaded", true);


Don't want to miss updates? Please click the below button!

Follow MindStick