D
D
Dima Sokolov2019-04-25 23:19:44
Android
Dima Sokolov, 2019-04-25 23:19:44

How to manage fragment creation?

Now the fragment is inserted through the xml fragment tag and the activity inherits OnFragmentInteractionListener
How can I make sure that the fragment does not appear after the creation of the activity, but is created / destroyed, for example, using a switch. It is the creation / destruction that is needed, and not the change of visibility.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2019-04-26
@dimka11

Don't use fragments in xml. Use FragmentManager and add/replace/remove.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question