开发者

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);
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜