Public final boolean isAdded ()
If the Fragment object is added to its Activity, true is returned; otherwise, false is returned.
Public final boolean isDetached ()
If the Fragment has been explicitly separated from the UI, it returns true. That is, use the FragmentTransaction. detach (Fragment) method on the Fragment object.
This method is introduced in API Level 13.
Public final boolean isHidden ()
If the Fragment object has been hidden, true is returned. By default, Fragment is displayed. You can use the onHiddenChanged (boolean) callback method to obtain the state change of the Fragment object. Note that the hidden State and other States are orthogonal-that is, the Fragment object must be displayed to the user, fragment objects must be started and not hidden.
Public final boolean isInLayout ()
If the layout is included in the Activity hierarchy tree using the <fragment> label, true is returned. When the Fragment is created using the <fragment> label, this method always returns true. Restore the old Fragment object from the previous State, except when the object is not displayed in the current State layout.
Public final boolean isRemoving ()
If the current Fragment object is being deleted from its Activity, true is returned. This deletion process is not the end Process of the Fragment object's Activity, but the process of deleting the Fragment object from its Activity.
Public final boolean isResumed ()
If the Fragment object is in the recovery state, this method returns true. During the onResume () and onPause () callbacks, this method returns true.
Public final boolean isVisible ()
If the Fragment object is visible to the user, true is returned. This means that it: 1. It has been added to the Activity; 2. Its View object has been bound to the window; 3. It has not been hidden.
Public void onActivityCreated (Bundle savedInstanceState)
When the Activity of the Fragment object is created and the View Hierarchy Tree of the Fragment object is instantiated, the system calls this method. This method can be used for some final initialization, such as obtaining or restoring the State. It can also be used for Fragment objects that use the setRetainInstance (boolean) method to keep their instances, this callback method tells the Fragment object when it is associated with the new Activity instance. This callback method is called after onCreateView (LayoutInflater, ViewGroup, Bundle) and before onStart.
Parameters
SavedInstanceState if the Fragment object is being rebuilt, this parameter specifies the previously saved state.
Public void onActivityResult (int requestCode, int resultCode, Intent data)
Receives the result from the previous call of the startActivityForResult (Intent, int) method. The onActivityResult (int, int, Intent) method is introduced in the Activity API introduction.
Parameters
The requestCode integer is the initial request Code provided by startActivityForResult () and can be used to identify the source of the result.
The resultCode integer is the result Code returned by the Child Activity through its setResult () method.
Data is an Intent type object that returns the result Data to the caller (it can pack various Data and bind it to the extras attribute field of the Intent object ).
Public void onAttach (Activity activity)
When this Fragment object is bound to its Activity for the first time, the system will call this method. After this method is called, the system will call the onCcreate (Bundle) method of the Fragment object.
Public void onConfigurationChanged (Configuration newConfig)
This method is called when the device configuration changes and the component is running. Note that, unlike the Activity, other components will not be restarted when the configuration changes: they will always re-obtain resources to handle such changes.
After this function is called, the updated resource object returns the resource value that matches the new configuration.
Parameters
NewConfing specifies the new device configuration.
Public boolean onContextItemSelected (MenuItem item)
When a menu item in the context menu is selected, the system calls this callback method. For a normal processing process, the default implementation of this method is simply to return false (call the Runnable object of the project or send a message to the corresponding Handler ). You can use this method to perform other operations on the menu items.
Use the getMenuInfo () method to obtain additional information set by the View object added to the menu item.
Its subclass application calls this method of the base class to implement default menu processing.
Parameters
Item this parameter specifies the selected context menu item.
Return Value
If normal context menu processing is allowed, false is returned; otherwise, true is returned.
Public void onCreate (Bundle savedInstanceState)
This method is called when the Fragment object is initially created. The call time is after onAttach (Activity) and before onCreateView (LayoutInflater, ViewGroup, Bundle.
Note that this method can also be called when its Fragment Activity is still being created. Therefore, you cannot depend on the context View Hierarchy Tree of the Activity being initialized at this time point.
Parameters
SavedInstanceState if the Fragment is being rebuilt, this parameter specifies the state before Fragment.
Public Animator onCreateAnimator (int transit, boolean enter, int nextAnim)
This method is called when the Fragment object loads an animation.
From FireOfStar's column