xxv / android-lifecycle

A diagram of the Android Activity / Fragment lifecycle
5.26k stars 681 forks source link

Update to latest Android version, add new onAttach() lifecycle callba… #26

Open wernerd opened 7 years ago

wernerd commented 7 years ago

…ck in fragment

Android M deprecated the onAttach(Activity) callback and introduced the new onAttach(Context) callback. To be backward compatible Android M and above calls both lifecycle functions which may lead to some unwanted double initializations etc. The output of the logcat clearly shows this.

The new code in TestFragment class deals with this.

I updated your really useful tool to run with the Android M version and probably also Android N.