How to use onPause with Android? -
using onsaveinstancestate(bundle ..) , onrestoreinstancestate(bundle ..)
, work, working when click turn off button on emulator.
now, want save state , restore saved data when below button used:

i think possible use onpause() or oonstop(), if right, how use it,
enough show me java source of saving 1 boolean variable, , restore it,
thanks.
i use onpause(), onstop() not guaranteed called. see application fundamentals details on lifecycle.
to save , restore boolean, use sharedpreferences. there code example on data storage page shows how save , restore boolean. use oncreate() , onstop(), use onresume() , onpause(), reasons have mentioned.
Comments
Post a Comment