Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Who calls fragment lifecycle methods (onCreate, onCreteView etc.) explicitly?

I looked at the source code of fragment (v4) http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.0.1_r1/android/support/v4/app/Fragment.java#Fragment but i cannot figure out who is calling lifecycle methods? who is standing behind that? some object or method must explictly call onCreate, onCreatView etc...

like image 839
Šime Tokić Avatar asked Dec 08 '25 21:12

Šime Tokić


1 Answers

Fragments share their lifecycle with their parent activity, which calls the lifecycle methods implicitly.

You can find the code here, with methods like dispatchActivityCreated, dispatchDestroy, etc.

like image 55
Simas Avatar answered Dec 11 '25 09:12

Simas



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!