开发者

Restore listView in android

开发者 https://www.devze.com 2023-03-16 01:48 出处:网络
I amnavigating from Activity_A to Activity_B and showing a list view in Activity_B , when I press back buttonin Activity_B control comes to Activity_A. Now, again I navigate to Activity_B, now I dont

I am navigating from Activity_A to Activity_B and showing a list view in Activity_B , when I press back button in Activity_B control comes to Activity_A. Now, again I navigate to Activity_B, now I dont want to create the list View once again instea开发者_如何学JAVAd I want to show the list View previously created. How to do this ? Any one please help me...

Thanks in advance....


when you start Activity_B set the Flag

FLAG_ACTIVITY_REORDER_TO_FRONT

Intent intent = new Intent(Activity_A.this, Activity_B.class);

intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);

startActivity(intent);

this flag will cause the launched activity to be brought to the front of its task's history stack if it is already running.


You need to save your Activity's state.

http://developer.android.com/guide/topics/fundamentals/tasks-and-back-stack.html

0

精彩评论

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