I am reading the book "Beginning Android Games,2nd Edition".
The page 129 says
'In onPause(), we simply pause our main loop thread, and if Activity.isFinishing() returns true, we also save to disk any state we want to persist.'
and the author does nothing in the onStop() method.
But the problem is that if isFinishing() returns false in onPause() but returns true in onStop(), we will lose unsaved data if we do not deal with onStop() method.
Any suggestions?
If isFinishing()
returned false in onPause
it will also return false in onStop
(and also in onDestroy
).
I guess that an exception to this could be if you call yourActivity.finish()
in the onPause
method. If you do that, isFinishing()
will return false before you call yourActivity.finish()
and true after.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With