Prepare two projects as follows
Set the dependency relations as follows
1. In LibraryProject
in “build.gradle” inside your LibraryModule folder,
make sure to set it as library using plugin and disable proguard
apply plugin: 'com.android.library'
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
2. In ApplicationProject
include ':ApplicationModule', '..:LibraryProject:yourLibraryModule'
in “build.gradle” inside your ApplicationModule folder
apply plugin: 'com.android.application'
Toolbar background color: #FFe0e0e0
Toolbar divider color: #FFbdbdbd with 1dp thickness
Negative button is located in left side.
If the input field is empty or nothing is selected, Positive button becomes disabled.
* Based on version 2.1.424.19.35
Though a Fragment’s lifecycle is tied to its owning activity, it has its own wrinkle on the standard activity lifecycle. It includes basic activity lifecycle methods such as onResume(), but also important are methods related to interactions with the activity and UI generation.
The core series of lifecycle methods that are called to bring a fragment up to resumed state (interacting with the user) are:
- onAttach(Activity) called once the fragment is associated with its activity.
- onCreate(Bundle) called to do initial creation of the fragment.
- onCreateView(LayoutInflater, ViewGroup, Bundle) creates and returns the view hierarchy associated with the fragment.
- onActivityCreated(Bundle) tells the fragment that its activity has completed its own Activity.onCreate().
- onViewStateRestored(Bundle) tells the fragment that all of the saved state of its view hierarchy has been restored.
- onStart() makes the fragment visible to the user (based on its containing activity being started).
- onResume() makes the fragment 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() 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.
- 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() allows the fragment to clean up resources associated with its View.
- onDestroy() called to do final cleanup of the fragment’s state.
- onDetach() called immediately prior to the fragment no longer being associated with its activity.