Generally, you should?not?use onPause() to store user changes (such as personal information entered into a form) to permanent storage. The only time you should persist user changes to permanent storage withinonPause() is when you're certain users expect the changes to be auto-saved (such as when drafting an email). However, you should avoid performing CPU-intensive work during onPause(), such as writing to a database, because it can slow the visible transition to the next activity (you should instead perform heavy-load shutdown operations during onStop()).
2016-07-03
以上結(jié)論有錯(cuò)誤,onPause和onStop一般都是成對(duì)出現(xiàn),鎖屏?xí)瑫r(shí)調(diào)用,非全屏dialog彈出時(shí),兩個(gè)都不會(huì)調(diào)用
2016-07-03
2015-06-05
是呀挺好記的。
基本上可以分3對(duì),ocreate對(duì)應(yīng)ondestroy 銷毀跟創(chuàng)建, onStart對(duì)應(yīng)onStop 可見(jiàn)與不可見(jiàn)都不能操作,onResum對(duì)應(yīng)onPause 都可見(jiàn) 前者可操作后者不可操作。
2015-05-06
說(shuō)得通俗一點(diǎn)就是:onPause就是你看得見(jiàn),但是無(wú)法操作;onStop就是你看都看不見(jiàn)。
2015-05-06
Generally, you should?not?use onPause() to store user changes (such as personal information entered into a form) to permanent storage. The only time you should persist user changes to permanent storage withinonPause() is when you're certain users expect the changes to be auto-saved (such as when drafting an email). However, you should avoid performing CPU-intensive work during onPause(), such as writing to a database, because it can slow the visible transition to the next activity (you should instead perform heavy-load shutdown operations during onStop()).