Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fragment lifecycle while navigating between fragments?

I do understand bit about fragment lifecycle, but I am finding me unable to visualize well the flow chart(or control diagram). When we move from one fragment to other. eg

            TheFragment tf6 = new TheFragment(); // TheFragment class extends Fragmet 
            adapter.addFragment(tf6 , naam[q--]);
            tf6.setArguments(args);

            TheFragment tf5 = new TheFragment(); another fragment
            adapter.addFragment(tf5 , naam[q--]);
            tf5.setArguments(args);

           `viewPager.setAdapter(adapter);`

Can anyone explain me just a flow of control or diagram in which we move from one fragment to other, so which method of which fragment called in a sequence.(Like OnPouse() of frag1 to onResume() of frag2 (for example)) Thanks in advance for your explanation.

like image 575
Saket Avatar asked Feb 06 '26 06:02

Saket


1 Answers

You can do it by creating a fragment class and overriding all its methods with a log. Just navigate and see which log appears when.

like image 119
swati kapoor Avatar answered Feb 07 '26 22:02

swati kapoor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!