为了账号安全,请及时绑定邮箱和手机立即绑定

onpause和onstop啥区别

onpause和onstop啥区别?一个说是隐藏,一个说是不可见?

正在回答

5 回答

以上结论有错误,onPause和onStop一般都是成对出现,锁屏会同时调用,非全屏dialog弹出时,两个都不会调用

0 回复 有任何疑惑可以回复我~


以上的结论有错
0 回复 有任何疑惑可以回复我~

是呀挺好记的。

基本上可以分3对,ocreate对应ondestroy 销毁跟创建, onStart对应onStop 可见与不可见都不能操作,onResum对应onPause 都可见 前者可操作后者不可操作。

2 回复 有任何疑惑可以回复我~

说得通俗一点就是:onPause就是你看得见,但是无法操作;onStop就是你看都看不见。

1 回复 有任何疑惑可以回复我~

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()).

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
Android-重识Activity
  • 参与学习       46093    人
  • 解答问题       43    个

Activity的系列教程的第一讲,将带您重新认识Activity

进入课程

onpause和onstop啥区别

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信