Question

when I am playing the game and I press the Home Key. The view is gone which is normal but when I start the game again a new game is started previous game is not resumed which is causing a lot of problem can any one help me with this issue?

Was it helpful?

Solution

@Override
    public void onCreate(Bundle b)
    {
        super.onCreate(b);
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);


    }

Doing this solved my problem

OTHER TIPS

add android:configChanges="keyboardHidden|orientation" to your activity in AndroidManifest

You are probably creating a new instance of the game in an onResume method, so check all your lifecycle methods.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top