开发者

How to save the sate of my Activity

I have an EditText followed by a list view under it. So it works like this - when u type something in the edit text it shows items from the list which match the text above. Anyway I need to save the state of list view. means if 开发者_StackOverflow中文版the user navigates away from this screen and comes back the list view should have the same state and the edit text should be filled with the same text. Hope u got it.

Please tell me how to achieve this.


Save your data in onPause(), and restore it in onResume() if needed.


You should save your edit text input string on (over ride those methods)

protected void onPause()

And when user returns, you just bind your string to edit text view on

protected void onResume()

http://developer.android.com/guide/topics/fundamentals/activities.html#Lifecycle

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜