片段捆绑问题中的onSavedInstance

时间:2013-07-17 20:30:59

标签: android android-fragments bundle

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 
root = inflater.inflate(R.layout.frag_alert_center, container, false);

if (savedInstanceState != null) {
            mItems = (ArrayList<AlertItemI>) savedInstanceState.getSerializable("itemBundle");
        }


//Everything else here
}

在底部我有

@Override
    public void onSaveInstanceState(Bundle outState) {
       super.onSaveInstanceState(outState);
       outState.putSerializable("itembundle", mItems);
    }

我这样做了吗? 当我调试时,它应该永远不会回到onCreateView()。

0 个答案:

没有答案