Tell me, my fragment is filled in onCreateView with respect to the data, and there is a situation in which the data has changed, but its display has not changed, how can I update the fragment, or just replace the layout? In fact, you need to call onCreateView again.

  • Before continuing in this direction, I recommend reading this answer . Everything said there applies to the fragment to the same extent. - pavlofff

2 answers 2

Take out the filling of the fragment with data in a separate method void render(Model model) and call this method in onCreateView, or when changing the model

  • There was such a thought, but how can I change the layout? I can’t explicitly specify it, I just return it as a View in onCreateView - Pasha Doncov

In general, I solved the problem after seeing a similar question, I just call detach , and then attach , and my layout is updated, I do not know about the quality of this solution. But it works