Reputation: 21
I Got stucked in saving the Checkboxes state and getting back in listview, i want to save what all the items were checked and save it and get it back when the Activity is called again... Pls help me in this with sample code... any help will be very usefull for me.
Upvotes: 0
Views: 297
Reputation: 722
Here is the sample code(But not using sharedPreferences)
public class SavedInstanceDemo extends Activity{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//retrieve values from savedInstanceState
Boolean isChecked=savedInstanceState.getBoolean("isChecked",false);
}
@Override
public void onSaveInstanceState (Bundle outState){
//save your requires values into this outState which can be retrieved on next time
outState.putBoolean("isChecked", true);
}
}
Upvotes: 2