Why I can't add a instance of Fragment?
See original GitHub issueThis can be a problem:
add(int title, java.lang.Class<? extends android.support.v4.app.Fragment> clazz)
I need to have a:
add(int title, Fragment fragment)
Why, If I need create a instance of the Fragment, I need use this.
Issue Analytics
- State:
- Created 8 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Cannot add Fragment on android - java - Stack Overflow
The problem is that you're using : import android.app.FragmentManager; import android.app.FragmentTransaction;. And your Fragment class ...
Read more >Creating and Using Fragments | CodePath Android Cliffnotes
Fragments must be embedded in activities ; they cannot run independently of ... There are two ways to add a fragment to an...
Read more >Create a fragment - Android Developers
A fragment has its own lifecycle, receives its own input events, and you can add or remove fragments while the containing activity is...
Read more >New viewmodel for every instance of same fragment #145
It opens a new instance of PersonFragment but gets the viewmodel of the previous PersonFragment; The app crashes with the following exception.
Read more >Android Fragments: FragmentContainerView - ProAndroidDev
When a Fragment's view is being created, a tag is assigned to it in order to associate it with the Fragment instance, this...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Please try checked Don’t keep activities in the developer mode. When you view again after returning to the home, it will change to a different instance. Often occurs is similar events in low memory device.
Solved!