1

I develop cocos2d-x android.

My question is when user press power button, is called onDestroy() after calling onPause(). This is connencted with memory leak problem? Why onDestroy() is called at that time? when it returns to app on Resume mode, it doesn't go to current screen. It goes to main screen. I think that it's connected with the problem- onDestroy() is called after calling onPause(). Is it right?

@Override public void onPause(){
    super.onPause();
    CCDirector.sharedDirector().pause();
}

@Override public void onDestroy(){
    super.onDestroy();
    CCDirector.sharedDirector().end();
}

Thank you for your help.

Chenggong Jin
  • 531
  • 1
  • 4
  • 9

2 Answers2

0

When you send your activity to background it could be destroyed any time by OS. Check if you are low on memory or try running application on device with more memory if you have one. Some times it helps if you just restart your phone.

  • Can you tell me how can I check the app is on low memory? – Chenggong Jin Jul 19 '13 at 08:46
  • You have to check if Android OS is low on memory, not your app. How to check this depends on which device you have. There are also application on Google Play which show you memory consumption. – user2071240 Jul 19 '13 at 09:14
0

try removing all the resources in onDestroy() method.

Sandeep R
  • 2,284
  • 3
  • 25
  • 51