android - Where can be use onSaveInstanceState where parameters are passed different Activity? -
for acitivity there method called onsaveinstacestate(bundle) used store data of activity overridden method.
as see, there 2 different onsaveinstancestate parameters passed differently below.
@override public void onsaveinstancestate(bundle outstate, persistablebundle outpersistentstate) { super.onsaveinstancestate(outstate, outpersistentstate); log.i("test", "onsaveinstancestate called **********"); }
and
@override protected void onsaveinstancestate(bundle outstate) { super.onsaveinstancestate(outstate); log.i("test", "onsaveinstancestate bundle called"); }
so, @ circumstances 2 methods can use? please describe in detail. in advance.
from api level 21, onsaveinstancestate()
has new parameter called takes object of persistablebundle
. can read more persistablebundle on docs
in short,
for api 21 , above
@override public void onsaveinstancestate(bundle outstate, persistablebundle outpersistentstate) { super.onsaveinstancestate(outstate, outpersistentstate); log.i("test", "onsaveinstancestate called **********"); }
for api less 20
@override protected void onsaveinstancestate(bundle outstate) { super.onsaveinstancestate(outstate); log.i("test", "onsaveinstancestate bundle called"); }
Comments
Post a Comment