如下android doc里面的原文

Generally, you shouldnotuseonPause()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 duringonPause(), 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 duringonStop()).

一般来说,我们不需要再onPause的时候将例如一个表单内容保存到物理内存中。只有当你确认一个用户引发的变化是必须被自动保存的时候,例如正在看一份邮件时,你就需要在onPause时保存这个邮件信息了。然而,在onPause的时候只适合做一些占用cpu极短时间的动作,例如写数据库就是一个耗时的工作,你应该在onStop的时候干这个事情

更多相关文章

  1. Android中InstanceState()使用详解
  2. android edittext不弹出软键盘
  3. android自动化(2)
  4. android Sqlite多线程访问异常解决方案
  5. android 判断sdcard是否存在,以及写入权限
  6. 【Android自学笔记】Android中的Log小技巧
  7. android按钮的操作例子,简单大家看明白_基础篇
  8. ClassCastException android.view.viewgroup.$layoutParam
  9. Android之使用RatingBar设置游戏难度并保存

随机推荐

  1. sqlite查询库里所有表名
  2. 使用 pymysql 操作MySQL数据库
  3. ASP.NET 2.0在SQL Server 2005上自定义分
  4. sql server2008 日志收缩 命令行
  5. PLSQL并非所有变量都已绑定
  6. mysql5.7 启用gtid,导致无法创建和删除表
  7. MySQL This function has none of DETERM
  8. MySql WorkBench“执行查询到文本输出”
  9. mysql报错注入(显错注入)整理
  10. mysql自定义排序规则函数——field()