user1551112
user1551112

Reputation: 61

my application restart when i pressed home button

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?

Upvotes: 4

Views: 5767

Answers (3)

overbet13
overbet13

Reputation: 1684

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.

Upvotes: 0

Fernando Gallego
Fernando Gallego

Reputation: 4116

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.

Upvotes: 1

Quintin B
Quintin B

Reputation: 5881

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

Upvotes: 0

Related Questions