Power Button Creating a Problem in AndEngine

I developed a game in andEngine, which is almost final. The only problem I am facing right now is that when during GamePlay, when you press the power button and the game resumes again, it starts with a star. Suppose I play at Level 6, and I pressed the power button, when the game resumes, it starts from Level 1. Can someone help me with this?

+4
source share
2 answers

You need to save the current state in onSaveInstanceState () and load it into onRestoreInstanceState () .

Check out this link: Android Actions

In particular:

+2
source

The main action detects when it pauses and is removed from memory. Take a look at Activity onPause () and onResume ().

0
source

Source: https://habr.com/ru/post/1392173/


All Articles