4

I developed a game in andEngine which is almost final. Only problem I am facing now is that when during GamePlay if power button is pressed and Game is resumed again It starts from star. Suppose I am playing Level 6 and I pressed power button when the game will be resumed it will start from Level 1. Can any one help me with this?

Jawad Amjad
  • 2,532
  • 2
  • 29
  • 59
  • You mean that pressing the power button so the `Phone option` interface appears, then pressing the back key to resume game play? – Jong Jan 21 '12 at 09:43

2 Answers2

2

You have to save current state in onSaveInstanceState() and load it in onRestoreInstanceState().

Check this link: Android activities

Specifically:

Ludevik
  • 6,954
  • 1
  • 41
  • 59
0

The main activity detects when it is being paused and taken out of memory. Look into the Activity onPause() and onResume().

zam664
  • 757
  • 1
  • 7
  • 18