android - savedInstanceState is always null -
this savedinstacestate code:
@override public void onsaveinstancestate(bundle savedinstancestate) { savedinstancestate.putstringarraylist("todo_arraylist", altodo); log.v("bundle", "saved"); super.onsaveinstancestate(savedinstancestate); } public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); if (savedinstancestate != null) { altodo = savedinstancestate.getstringarraylist("todo_arraylist"); log.v("bundle", "restored"); } else { log.v("bundle", "null"); } setcontentview(r.layout.main); }
the logs show "bundle save" tag.
but in oncreate
method, savedinstancestate
null.
did check if have id set view ( if view is/has...). onsaveinstancestate() not called otherwise.
check link.
Comments
Post a Comment