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?

有帮助吗?

解决方案

@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

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top