Normal | setRetainInstance(true) | Description |
---|---|---|
onAttach | onAttach | Called once the fragment is associated with its activity. |
onCreate | - | Called to do initial creation of the fragment. |
onCreateView | onCreateView | Creates and returns the view hierarchy associated with the fragment. |
onActivityCreated | onActivityCreated | Tells the fragment that its activity has completed its own Activity.onCreate(). |
onViewStateRestored | onViewStateRestored | Tells the fragment that all of the saved state of its view hierarchy has been restored. |
onStart | onStart | Makes the fragment visible to the user (based on its containing activity being started). |
onResume | onResume | Makes the fragment begin interacting with the user (based on its containing activity being resumed). As a fragment is no longer being used, it goes through a reverse series of callbacks: |
onPause | onPause | Fragment is no longer interacting with the user either because its activity is being paused or a fragment operation is modifying it in the activity. |
onSaveInstance | onSaveInstance | Called to ask the fragment to save its current dynamic state, so it can later be reconstructed in a new instance of its process is restarted. |
onStop | onStop | Fragment is no longer visible to the user either because its activity is being stopped or a fragment operation is modifying it in the activity. |
onDestroyView | onDestroyView | Allows the fragment to clean up resources associated with its View. |
onDestroy | - | Called to do final cleanup of the fragment's state. |
onDetach | onDetach | Called immediately prior to the fragment no longer being associated with its activity. |
I posted how to setup Kotlin and DataBinding in Android Stuido in the last blog (http://marksunghunpark.blogspot.com.au/2017/04/kotlin-binding-library-setup-in-android.html). In this post, I am going to how to use DataBiding in the MainActivity when you create a navigation drawer project from Android Studio templates. Layouts You will have four layouts in app/src/res/layout folder: app/src/main/res/layout/activity_main.xml app/src/main/res/layout/app_bar_main.xml app/src/main/res/layout/content_main.xml app/src/main/res/layout/nav_header_main.xml And activity_main.xml contains all other layout using include layout. You need to have tag in activity_main.xml , app_bar_main.xml and content_main.xml . If you don't have the tag, Binding library cannot recognise the sub layouts properly. Binding library doesn't support toolbar and navigation drawer yet, so you can use using BindingAdapter if you want to use binding library.(But I'm gong to skip this part for simplici...
Comments
Post a Comment