This problem was encountered in the project. Headache for a long time, always can not reproduce, and can not be solved well. Always after the interest screen for a period of time, it will be reported java.lang.IllegalArgumentException:No view found for the ID for .... Problem, and then the program crashes. I believe a lot of friends have the same problem as me. So how to solve this problem?
After careful study of fragment's manager, here's what I found
What the heck? How can there be two of Fragmentmanager. What's the matter with these two things?
The API says a lot, and here's a brief summary.
If fragment is in replace new fragment, the container uses a part of the activity layout or the whole as a container, then use Getfragmentmanager ();
That is, the Getfragmentmanager is the manager of the activity to the included fragment.
If fragment is in replace new fragment, the container uses the fragment layout file of a whole or part of view as a container, then it is used Getchildfragmentmanager ();
That is: fragment nested fragment, you need to use Getchildfragmentmanager ()
Android--fragment long time home or lock screen Java.lang.IllegalArgumentException:No view found for ID ....