Android libgdx preferences not working

前端 未结 1 552
遥遥无期
遥遥无期 2021-01-23 09:14

Probably a stupid question, but what do I have to change to make this code work:

package com.hobogames.WizardsDuel;

import com.badlogic.gdx.Gdx;
import com.badl         


        
1条回答
  •  遥遥无期
    2021-01-23 09:26

    I suspect you're getting bitten by the static state behaving differently in Android and on your Desktop. Are you sure the VM exits when you exit the app on Android? If you restart your app quickly on Android, the system will reuse the same Dalvik VM for the new Activity. Since the static boolean is already initialized, the initialization isn't re-run. If you remove the static so this stuff gets re-run when GameData is created (presumably instances of it are not being stored in static variables) you should get farther.

    See http://bitiotic.com/blog/2013/05/23/libgdx-and-android-application-lifecycle/

    0 讨论(0)
提交回复
热议问题