johnkil / Android-ProgressFragment

Implementation of the fragment with the ability to display indeterminate progress indicator when you are waiting for the initial data.
http://johnkil.github.io/Android-ProgressFragment/
Apache License 2.0
807 stars 214 forks source link

java.lang.NullPointerException on mHandler.removeCallbacks(mShowContentRunnable); #20

Closed giwrgos88 closed 10 years ago

giwrgos88 commented 10 years ago

I have an issue when i'm moving from the portrait mode to landscape mode on mHandler.removeCallbacks(mShowContentRunnable); the onDestroyView is under a class that extends ProgressFragment How i can fix it?

@Override
public void onDestroyView() {
    super.onDestroyView();
    mHandler.removeCallbacks(mShowContentRunnable);
}

Here my error log 02-27 20:30:44.474: E/AndroidRuntime(19930): FATAL EXCEPTION: main 02-27 20:30:44.474: E/AndroidRuntime(19930): Process: com.georgiospanayi.cyprusshots, PID: 19930 02-27 20:30:44.474: E/AndroidRuntime(19930): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.georgiospanayi.cyprusshots/com.georgiospanayi.cyprusshots.HomeActivity}: java.lang.NullPointerException 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3738) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.app.ActivityThread.access$900(ActivityThread.java:135) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1202) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.os.Handler.dispatchMessage(Handler.java:102) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.os.Looper.loop(Looper.java:136) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.app.ActivityThread.main(ActivityThread.java:5017) 02-27 20:30:44.474: E/AndroidRuntime(19930): at java.lang.reflect.Method.invokeNative(Native Method) 02-27 20:30:44.474: E/AndroidRuntime(19930): at java.lang.reflect.Method.invoke(Method.java:515) 02-27 20:30:44.474: E/AndroidRuntime(19930): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 02-27 20:30:44.474: E/AndroidRuntime(19930): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 02-27 20:30:44.474: E/AndroidRuntime(19930): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:126) 02-27 20:30:44.474: E/AndroidRuntime(19930): at dalvik.system.NativeStart.main(Native Method) 02-27 20:30:44.474: E/AndroidRuntime(19930): Caused by: java.lang.NullPointerException 02-27 20:30:44.474: E/AndroidRuntime(19930): at com.georgiospanayi.fragments.PlaceholderFragment.onDestroyView(PlaceholderFragment.java:177) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.support.v4.app.Fragment.performDestroyView(Fragment.java:1705) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:996) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.support.v4.app.FragmentManagerImpl.removeFragment(FragmentManager.java:1201) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:639) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:570) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.app.Activity.performStart(Activity.java:5241) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2168) 02-27 20:30:44.474: E/AndroidRuntime(19930): ... 13 more