这是MainActivity中的代码 MainActivity.java:541
@Override
public void onSaveInstanceState (Bundle savedInstanceState) {
super.onSaveInstanceState(savedInstanceState);
savedInstanceState.putInt("mCurrentChapter", mCurrentChapter);
savedInstanceState.putInt("index", mPager.getCurrentItem());
////Log.e("SaveInstance", mCurrentChapter + " " + mPager.getCurrentItem());
}
我没有看到任何问题。
java.lang.NullPointerException
at com.techexpert4u.duaaadhkaar.MainActivity.onSaveInstanceState(MainActivity.java:541)
at android.app.Activity.performSaveInstanceState(Activity.java:1153)
at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1223)
at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3175)
at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3234)
at android.app.ActivityThread.access$1100(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1223)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)