Android onResume Show Previous state of Activity

孤街浪徒 提交于 2019-12-11 19:16:44

问题


In my project I've several controls in my activity listView checkboxes and textboxes in several tabs now what i've seen when i press home key or recieve a call my activity put into pause and the control get reset (like listview will have to rebind & checkbox get unchecked) to prevent it i set saveEnabled = "true" but it does not work for listview Now i'll have to rebind my tabs again and fill the listview again

tell me is there any method which will save my current state and onResume will resume the previous one.


回答1:


You should save your state in onPause() method and you can refresh your view in onResume()




回答2:


There is no such API to save the state of the activity. You yourself have to save the state using SharedPreferences or some other method in onPause() and retrieve the state in onResume().



来源:https://stackoverflow.com/questions/10412304/android-onresume-show-previous-state-of-activity

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!