onAttach() not called in Fragment

It’s not called because this method has been added in API 23. If you run your application on a device with API 23 (marshmallow) then onAttach(Context) will be called. On all previous Android Versions onAttach(Activity) will be called.

http://developer.android.com/reference/android/app/Fragment.html#onAttach(android.app.Activity)

Support libraries fragment is platform independent. Hence it works on all API versions.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)