FragmentHostCallback

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.

FragmentManager changes its behavior based on what optional interfaces your FragmentHostCallback implements. This includes the following:

Parameters

H

the type of object that's currently hosting the fragments. An instance of this class must be returned by onGetHost.

Constructors

Link copied to clipboard
constructor(context: Context, handler: Handler, windowAnimations: Int)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open fun onDump(prefix: String, fd: FileDescriptor?, writer: PrintWriter, args: Array<String>?)

Print internal state into the given stream.

Link copied to clipboard
open override fun onFindViewById(id: Int): View?

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

Link copied to clipboard
abstract fun onGetHost(): H

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

Link copied to clipboard

Return the window animations.

Link copied to clipboard
open override fun onHasView(): Boolean

Return true if the container holds any view.

Link copied to clipboard

Return true if there are window animations.

Link copied to clipboard
open fun onRequestPermissionsFromFragment(fragment: Fragment, permissions: Array<String>, requestCode: Int)

Requests permissions from the given fragment. See FragmentActivity.requestPermissions

Link copied to clipboard

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

Link copied to clipboard

Checks whether to show permission rationale UI from a fragment. See FragmentActivity.shouldShowRequestPermissionRationale

Link copied to clipboard
open fun onStartActivityFromFragment(fragment: Fragment, intent: Intent, requestCode: Int)
open fun onStartActivityFromFragment(fragment: Fragment, intent: Intent, requestCode: Int, options: Bundle?)

Starts a new Activity from the given fragment. See FragmentActivity.startActivityForResult.

Link copied to clipboard
open fun onStartIntentSenderFromFragment(fragment: Fragment, intent: IntentSender, requestCode: Int, fillInIntent: Intent?, flagsMask: Int, flagsValues: Int, extraFlags: Int, options: Bundle?)

Starts a new IntentSender from the given fragment. See Activity.startIntentSender.

Link copied to clipboard

Invalidates the activity's options menu. See FragmentActivity.supportInvalidateOptionsMenu