ncapdevi / FragNav

An Android library for managing multiple stacks of fragments
1.5k stars 220 forks source link

Understanding Lifecycle #47

Closed finneapps closed 7 years ago

finneapps commented 7 years ago

I am testing the Bottom Tab demo and there is something that I don't quite understand. If I have opened 4 sub-fragments and then press on the back button, then onCreateView will be called on the previous Fragment, but the View is already created. So the Views are being created twice. The mBotton is already created before mButton = (Button) view.findViewById(R.id.button); is called. Is this the expected behaviour?

ncapdevi commented 7 years ago

@finneapps Hey there, all of that is part of default Android behaviour. Try to keep issues here specific to the library. I believe the info you're looking for can be explained here https://developer.android.com/reference/android/app/Fragment.html and http://stackoverflow.com/questions/24156926/oncreateview-method-gets-called-when-and-how-many-times-in-activity-life-cycle

Best of luck!