Skip to content Skip to sidebar Skip to footer

Fragment Doesn't Show Second Time It's Used

I have a single Activity architecture where I'm loading a PreferenceFragmentCompat inside another ViewGroup in the MainActivity. Custom navigation exists within the MainActivity so

Solution 1:

I found the issue. It was a lot simpler than I expected. Because a new ViewGroup was being created every time, the fragment was being added to the old ViewGroup before it could be replaced by the new one, since they both contain the R.id.fragment_frame_container view. The solution was to just not create a new ViewGroup each time if it already existed.


Post a Comment for "Fragment Doesn't Show Second Time It's Used"