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一般都是成對出現(xiàn),鎖屏?xí)瑫r(shí)調(diào)用,非全屏dialog彈出時(shí),兩個(gè)都不會(huì)調(diào)用
2016-07-03
2015-06-05
是呀挺好記的。
基本上可以分3對,ocreate對應(yīng)ondestroy 銷毀跟創(chuàng)建, onStart對應(yīng)onStop 可見與不可見都不能操作,onResum對應(yīng)onPause 都可見 前者可操作后者不可操作。
2015-05-06
說得通俗一點(diǎn)就是:onPause就是你看得見,但是無法操作;onStop就是你看都看不見。
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()).