4

I have my android application that is running. I press "home button" to return to the menu application than I press on the my app icon to resume it, but is called the method "onCreate()" of my FIRST activity instead the method "onResume()" of the LAST activity seen before press the "home button".

I have this problem only on physical device and not on android emulator. Is there some attribute to set on Manifest File?

Have you any ideas?

user1551112
  • 61
  • 1
  • 2
  • When my application restarts, if I press the back key I see the last activity that i've seen before to press the home button. that means that the previous activities are not destroyed, but the first activity overwrite the others! – user1551112 Jul 25 '12 at 10:33

3 Answers3

2

Make sure that you don't have enabled the developer option: destroy activities when leaving them. I happened to me that I enabled this option and I forgot about it, so every activity was restarting each time.

Fernando Gallego
  • 4,064
  • 31
  • 50
  • First of all, this is referring to Settings -> Developer Options -> Don't keep activities. Second, this option is not enabled by default. – jordanpg Jul 24 '14 at 18:49
0

There should be a Bundle being sent to your onCreate method. That bundle contains information on how to resume your app.

I recommend you put Log.d("",""); messages into your onCreate() and onResume() methods to see when which one is being called. Show me some code and I can help further.

Please see these: Android example which uses onResume, onStart and onRestart http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle

Community
  • 1
  • 1
Quintin Balsdon
  • 5,484
  • 10
  • 54
  • 95
0

Probably your device is running out or memory. Override the onLowMemory() method, and put a log in it or something to see if it is getting called or not.

overbet13
  • 1,654
  • 1
  • 20
  • 36