M
M
mitaichik2016-07-20 23:11:39
Android
mitaichik, 2016-07-20 23:11:39

What is the lifecycle of a fragment in a fragment?

Hello! I have a fragment that hosts fragments (let's call them sub-fragments). The network is full of examples of how to work with callbacks from a fragment in an activity ( https://developer.android.com/guide/components/fra... There, in onAttach, a listener is made from an activity, in onDetach we make a listener = null. This is all clear.
But I need to make the listener not from the activity, but from the parent fragment.Therefore, the question is: at what stages of the fragment life cycle is it correct to refer to the parent fragment? Also in onAttach / onDetach?
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Tiberal, 2016-07-21
@Tiberal

https://developer.android.com/reference/android/ap...
the answer assumes that you are familiar with the differences between fragment managers

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question