0

I have two activities in tabgroup fist activity contains listview, when listitem click loading second activity.he my problem is when we press back in second activity first activity list is reloading again is it possible to stop reloading and i need to show listview in same position.

@Override
    public void onBackPressed() {
        // TODO Auto-generated method stub
        super.onBackPressed();
    }

using onbackpress for finish second activity.I had write loading data in oncreate() for listview,but here oncreate() is again calling.how to stop calling oncreate() when we come back.If anyone have idea please help me.

sai
  • 2,562
  • 8
  • 31
  • 46
  • dont initaite your first listview on create method. if you need to do so stop it on ActivityResult. Please do put some code so its easy for other to guide you – MDMalik Jun 14 '13 at 07:20
  • @MDMalik - onCreate should not be called again when back is pressed, however it would be paused and resumed, it's possible that some code in onResume is causing the list to be refreshed but unlikely that it's code in onCreate. Hard to say without code. – Philio Jun 14 '13 at 07:22
  • 1
    If you don't want the list to reload, then populate it in `onCreate` because if you do this in `onPause` or `onResume` these methods will be called as per the [activity lifecycle](http://developer.android.com/reference/android/app/Activity.html). Without seeing your code, can't really say more. – Ali Jun 14 '13 at 07:33

1 Answers1

0

If the first activity seized too much memory, and system is under low memory situation, system might kill the first activity automatically. In that case, when you back to the first activity from the second, onCreate() will be called again.

You may do a test. In the first activity, just load a little of data, then see if onCreate is called again when back from the second activity.

TieDad
  • 9,143
  • 5
  • 32
  • 58
  • if we see facebook app in that share list size too much memory,when we click comments in listview item its showing in next screen and back press listview is in same.how it possible there. – sai Jun 14 '13 at 09:01