I cant find a difinitive way to save the state of a spinner in onSaveInstanceState, and recall it . . . please help
I cant find a difinitive way to save the state of a spinner in onSaveInstanceState, and recall it . . . please help.
I have spent ho开发者_高级运维urs looking and I cannot find anything about this. . . . I only want it temporarily. i do not want to use SharedPreferences.
for spinner i think you use arrayList so you have to save arrayList
@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putStringArrayList("arrUserIds", arrUserIds);
super.onSaveInstanceState(outState);
}
and you can restore arrayList onRestoreInstanceState method
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
arrUserIds = savedInstanceState.getStringArrayList("arrUserIds");
super.onRestoreInstanceState(savedInstanceState);
}
精彩评论