Android APIs
public abstract class

FragmentHostCallback

extends FragmentContainer
java.lang.Object
   ↳ android.app.FragmentContainer
     ↳ android.app.FragmentHostCallback<E>

Class Overview

Integration points with the Fragment host.

Fragments may be hosted by any object; such as an Activity. In order to host fragments, implement FragmentHostCallback, overriding the methods applicable to the host.

Summary

Public Constructors
FragmentHostCallback(Context context, Handler handler, int windowAnimations)
Public Methods
void onAttachFragment(Fragment fragment)
Called when a Fragment is being attached to this host, immediately after the call to its onAttach(Context) method and before onCreate(Bundle).
void onDump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args)
Print internal state into the given stream.
View onFindViewById(int id)
Return the view with the given resource ID.
abstract E onGetHost()
Return the object that's currently hosting the fragment.
LayoutInflater onGetLayoutInflater()
Return a LayoutInflater.
int onGetWindowAnimations()
Return the window animations.
boolean onHasView()
Return true if the container holds any view.
boolean onHasWindowAnimations()
Return true if there are window animations.
void onInvalidateOptionsMenu()
Invalidates the activity's options menu.
void onRequestPermissionsFromFragment(Fragment fragment, String[] permissions, int requestCode)
Requests permissions from the given fragment.
boolean onShouldSaveFragmentState(Fragment fragment)
Return true if the fragment's state needs to be saved.
void onStartActivityFromFragment(Fragment fragment, Intent intent, int requestCode, Bundle options)
Starts a new Activity from the given fragment.
boolean onUseFragmentManagerInflaterFactory()
Return true if the FragmentManager's LayoutInflaterFactory should be used.
[Expand]
Inherited Methods
From class android.app.FragmentContainer
From class java.lang.Object

Public Constructors

public FragmentHostCallback (Context context, Handler handler, int windowAnimations)

Added in API level 23

Public Methods

public void onAttachFragment (Fragment fragment)

Added in API level 23

Called when a Fragment is being attached to this host, immediately after the call to its onAttach(Context) method and before onCreate(Bundle).

public void onDump (String prefix, FileDescriptor fd, PrintWriter writer, String[] args)

Added in API level 23

Print internal state into the given stream.

Parameters
prefix Desired prefix to prepend at each line of output.
fd The raw file descriptor that the dump is being sent to.
writer The PrintWriter to which you should dump your state. This will be closed for you after you return.
args additional arguments to the dump request.

public View onFindViewById (int id)

Added in API level 23

Return the view with the given resource ID. May return null if the view is not a child of this container.

public abstract E onGetHost ()

Added in API level 23

Return the object that's currently hosting the fragment. If a Fragment is hosted by a Activity, the object returned here should be the same object returned from getActivity().

public LayoutInflater onGetLayoutInflater ()

Added in API level 23

public int onGetWindowAnimations ()

Added in API level 23

Return the window animations.

public boolean onHasView ()

Added in API level 23

Return true if the container holds any view.

public boolean onHasWindowAnimations ()

Added in API level 23

Return true if there are window animations.

public void onInvalidateOptionsMenu ()

Added in API level 23

Invalidates the activity's options menu. See invalidateOptionsMenu()

public void onRequestPermissionsFromFragment (Fragment fragment, String[] permissions, int requestCode)

Added in API level 23

Requests permissions from the given fragment. See requestPermissions(String[], int)

public boolean onShouldSaveFragmentState (Fragment fragment)

Added in API level 23

Return true if the fragment's state needs to be saved.

public void onStartActivityFromFragment (Fragment fragment, Intent intent, int requestCode, Bundle options)

Added in API level 23

Starts a new Activity from the given fragment. See startActivityForResult(Intent, int).

public boolean onUseFragmentManagerInflaterFactory ()

Added in API level 23

Return true if the FragmentManager's LayoutInflaterFactory should be used.