Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the method onSaveInstanceState(Bundle) called after onPause()?

I'm new to android and I read a book for beginners which said that onSaveInstanceState(Bundle) is ensured to be called before the system reclaims your Activity. I tried it on some test codes and found it incorrect. I found that onSaveInstanceState(Bundle) was called every time after onPause() was called. And it has nothing to do with system reclaimation. I'm not very sure about it, so that's the question: when is onSaveInstanceState(Bundle) called actually?

like image 873
Xun Chenlong Avatar asked Aug 24 '15 07:08

Xun Chenlong


1 Answers

I don't agree with a previous answer.
According to the Documentation:

If called, this method will occur before onStop(). There are no guarantees about whether it will occur before or after onPause().

like image 144
Giuseppe Dini Avatar answered Oct 31 '22 05:10

Giuseppe Dini