If you look at the Activity LifeCycle : When you go to another activity, and press back, it will call finish(). The first activity was on the onStop() method because it was no longer visible. So, when you come back to the first activity, it will call the method onStart(), and on Stop() Try to overload this method without calling the super method (it might be a very bad idea) You can also try to remember the position when you was (get the index of the current tab), and on the onResume() method, set the current tab to this index You just need an int attribute savedPosition in your listactivity.
Private int savedPosition = -1 Override protected void onPause() { savedPosition = getListView(). GetFirstVisiblePosition(); super.onPause(); } @Override protected void onResume() { super.onResume(); if(savedPosition! = -1) { getList().
SetSelection(savedPosition); } }.
If you look at the Activity LifeCycle : When you go to another activity, and press back, it will call finish(). The first activity was on the onStop() method because it was no longer visible. So, when you come back to the first activity, it will call the method onStart(), and on Stop().
Try to overload this method without calling the super method (it might be a very bad idea). You can also try to remember the position when you was (get the index of the current tab), and on the onResume() method, set the current tab to this index. You just need an int attribute savedPosition in your listactivity.
Private int savedPosition = -1; @Override protected void onPause() { savedPosition = getListView(). GetFirstVisiblePosition(); super.onPause(); } @Override protected void onResume() { super.onResume(); if(savedPosition! = -1) { getList().
SetSelection(savedPosition); } }.
Perhaps you can use onSaveInstanceState() to save what's needed to be saved and then restore your activity in onCreate().
I use following code to save a variable value IsAlreadyLoaded. @Override public void onSaveInstanceState(Bundle savedInstanceState) { savedInstanceState. PutBoolean("IsAlreadyLoaded", true); super.
OnSaveInstanceState(savedInstanceState); } and retreive this value in oncreate event when back to activity. However I got savedInstanceState as null and I m not able to get what I have saved. In below code savedInstanceState is always null `boolean myBoolean = savedInstanceState.
GetBoolean("IsAlreadyLoaded"); – Asif Aug 9 at 9:47 where do you implement onSaveInstanceState? Can you post all code where you save/retrieve the data? – Asahi Aug 9 at 9:54 onCreate is not called when you come back to a previous activity, except if the memory was low, and system decided to call onDestroy on the activity.
– NitroG42 Aug 9 at 9:56 I'm sorry but I don't really understand. When you press back, the current activity is destroy, and the previous activity call onStart/onResume. Here, it seems this is the TabHostActivity.
If the only way to load data in your list activity is in the onCreate, so it seems like the TabHostActivity recreate all tab when onStart or onResume is called. But I have read that you need to call specially tabhost. DestroyActivity and startActivity to "recreate" activities.My point is that it shouldn't call the onCreate of your ListActivity when you press back, you should look why.
– NitroG42 Aug 9 at 10:19 @Asahi, I override the onSaveInstanceState and save a variable with value true, like below @Override public void onSaveInstanceState(Bundle savedInstanceState) { savedInstanceState. PutBoolean("IsAlreadyLoaded", true); super. OnSaveInstanceState(savedInstanceState); } and then try to get that value in onCreate like follwoing boolean myBoolean = savedInstanceState.
GetBoolean("IsAlreadyLoaded"); but fails to get variable value because savedInstanceState object is null – Asif Aug 9 at 10:47.
Data is avoided when reading the published variable so as to not mistakenly identify as published. (Not only does the read occur before the memory barrier, the memory barrier is. Avoid data.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.