Fragment Loading Error: java.lang.IllegalArgumentException: No view found for id …

07-16 11:26:49.131 9982 9982 E AndroidRuntime: FATAL EXCEPTION: main
07-16 11:26:49.131 9982 9982 E AndroidRuntime: Process: com.android.gallery3d, PID: 9982
07-16 11:26:49.131 9982 9982 E AndroidRuntime: java.lang.IllegalArgumentException: No view found for id 0x7f0d0070 (com.android.gallery3d:id/state_panel_container) for fragment StatePanel{894ba12 #28 id=0x7f0d0070 StatePanel}
07-16 11:26:49.131 9982 9982 E AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1411)
07-16 11:26:49.131 9982 9982 E AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1741)
07-16 11:26:49.131 9982 9982 E AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1810)
07-16 11:26:49.131 9982 9982 E AndroidRuntime: at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:797)
07-16 11:26:49.131 9982 9982 E AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2581)
07-16 11:26:49.131 9982 9982 E AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2368)
07-16 11:26:49.131 9982 9982 E AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2323)
07-16 11:26:49.131 9982 9982 E AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2230)
07-16 11:26:49.131 9982 9982 E AndroidRuntime: at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:700)
07-16 11:26:49.131 9982 9982 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:790)
07-16 11:26:49.131 9982 9982 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
07-16 11:26:49.131 9982 9982 E AndroidRuntime: at android.os.Looper.loop(Looper.java:164)
07-16 11:26:49.131 9982 9982 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6494)
07-16 11:26:49.131 9982 9982 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
07-16 11:26:49.131 9982 9982 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
07-16 11:26:49.131 9982 9982 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

First, according to the ID number to find the corresponding Fragment container (R.id.state_panel_container), found that the corresponding container is not found in the loading time, that is, the page does not have the ID number, that is, there is no VIEW.

The reason for this is that getFragmentManager() and getChildFragmentManager() are two different ways of loading. getFragmentManager() is to get the FragmentManager of the Fragment bound activity, and the layout obtained is also activity.

And getChildFragmentManager() gets the FragmentManager of Fragment itself, and the layout obtained is the Fragment’s own layout.

Because of the code found in a section of the wrong way to use getFragmentManager(), the layout obtained is naturally the layout of the activity bound by Fragment, after review, the layout is indeed not found in this VIEW (state_panel_container), which led to the occurrence of this exception.

Similar Posts: