andengineを使用してAndroidゲームを開発しています。問題は、powerinterrupt または screenlock で強制終了エラーが発生したときです。私のコードn logcatエラーは以下の通りです:
public class ScreenReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
wasScreenOn=true;
}else if (intent.getAction().equals(Intent.ACTION_USER_PRESENT )){
wasScreenOn=true;
}
if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
wasScreenOn=false;
}
}
//onresume メソッド
protected void onResume() {
if(wasScreenOn){
RESUME GAME
}
}
ログキャット エラー:
12-21 12:26:07.016: ERROR/AndroidRuntime(1220): FATAL EXCEPTION: main
12-21 12:26:07.016: ERROR/AndroidRuntime(1220): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.m2f.StepUpPuzzle/com.m2f.StepUpPuzzle.GameActivity}: java.lang.NumberFormatException: unable to parse 'null' as integer
12-21 12:26:07.016: ERROR/AndroidRuntime(1220): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1740)
12-21 12:26:07.016: ERROR/AndroidRuntime(1220): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1759)
12-21 12:26:07.016: ERROR/AndroidRuntime(1220): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:2938)
12-21 12:26:07.016: ERROR/AndroidRuntime(1220): at android.app.ActivityThread.access$1600(ActivityThread.java:155)
12-21 12:26:07.016: ERROR/AndroidRuntime(1220): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1003)
12-21 12:26:07.016: ERROR/AndroidRuntime(1220): at android.os.Handler.dispatchMessage(Handler.java:130)
12-21 12:26:07.016: ERROR/AndroidRuntime(1220): at android.os.Looper.loop(SourceFile:351)
12-21 12:26:07.016: ERROR/AndroidRuntime(1220): at android.app.ActivityThread.main(ActivityThread.java:3826)
12-21 12:26:07.016: ERROR/AndroidRuntime(1220): at java.lang.reflect.Method.invokeNative(Native Method)
12-21 12:26:07.016: ERROR/AndroidRuntime(1220): at java.lang.reflect.Method.invoke(Method.java:538)
12-21 12:26:07.016: ERROR/AndroidRuntime(1220): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:969)
12-21 12:26:07.016: ERROR/AndroidRuntime(1220): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:727)
12-21 12:26:07.016: ERROR/AndroidRuntime(1220): at dalvik.system.NativeStart.main(Native Method)