首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

Activity(1)

2012-07-01 
Activity(一)How to start an Intent?Saving activity stateTheres no guarantee that onSaveInstanceSta

Activity(一)
How to start an Intent?





Saving activity state

There's no guarantee that onSaveInstanceState() will be called before your activity is destroyed,  If the system calls onSaveInstanceState(), it does so before onStop() and possibly before onPause().

Because the default implementation of onSaveInstanceState() helps save the state of the UI, if you override the method in order to save additional state information, you should always call the superclass implementation of onSaveInstanceState() before doing any work. Likewise, you should also call the supercall implementation of onRestoreInstanceState() if you override it, so the default implementation can restore view states.

A good way to test your application's ability to restore its state is to simply rotate the device so that the screen orientation changes.

热点排行