I have the following interface implementation in my fragment:
@Override public void onReportChanged(Fragment sender, long id, int position) {
The FragmentActivity report for this fragment, this other fragment (selection list) selected one element. After this, the ListFragment should load the new data with the reported identifier (_ReportId).
But I get a NullPoinerException
in this code before moving on to the onCreateLoader-Method. Here is the LogCat:
05-28 14:24:37.905: E/AndroidRuntime(1775): FATAL EXCEPTION: main 05-28 14:24:37.905: E/AndroidRuntime(1775): java.lang.NullPointerException 05-28 14:24:37.905: E/AndroidRuntime(1775): at android.support.v4.app.LoaderManagerImpl.restartLoader(LoaderManager.java:637) 05-28 14:24:37.905: E/AndroidRuntime(1775): at de.webducer.android.worktime.beta.ui.fragment.ReportListFragment.onReportChanged(ReportListFra gment.java:142) 05-28 14:24:37.905: E/AndroidRuntime(1775): at de.webducer.android.worktime.beta.ui.ReportListActivity.onReportSelected(ReportListActivity.java:97) 05-28 14:24:37.905: E/AndroidRuntime(1775): at de.webducer.android.worktime.beta.ui.fragment.ReportSelectorSpinnerFragment$1.onItemSelected(ReportSelectorSpinnerFragment.java:78) 05-28 14:24:37.905: E/AndroidRuntime(1775): at android.widget.AdapterView.fireOnSelected(AdapterView.java:882) 05-28 14:24:37.905: E/AndroidRuntime(1775): at android.widget.AdapterView.access$200(AdapterView.java:48) 05-28 14:24:37.905: E/AndroidRuntime(1775): at android.widget.AdapterView$SelectionNotifier.run(AdapterView.java:848) 05-28 14:24:37.905: E/AndroidRuntime(1775): at android.os.Handler.handleCallback(Handler.java:605) 05-28 14:24:37.905: E/AndroidRuntime(1775): at android.os.Handler.dispatchMessage(Handler.java:92) 05-28 14:24:37.905: E/AndroidRuntime(1775): at android.os.Looper.loop(Looper.java:137) 05-28 14:24:37.905: E/AndroidRuntime(1775): at android.app.ActivityThread.main(ActivityThread.java:4424) 05-28 14:24:37.905: E/AndroidRuntime(1775): at java.lang.reflect.Method.invokeNative(Native Method) 05-28 14:24:37.905: E/AndroidRuntime(1775): at java.lang.reflect.Method.invoke(Method.java:511) 05-28 14:24:37.905: E/AndroidRuntime(1775): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 05-28 14:24:37.905: E/AndroidRuntime(1775): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 05-28 14:24:37.905: E/AndroidRuntime(1775): at dalvik.system.NativeStart.main(Native Method)
I do not understand why. The same code (but for a different list) works fine on a different FragmentActivity.
source share