Added in API level 23
Deprecated in API level 28

FragmentHostCallback


abstract class FragmentHostCallback<E : Any!> : FragmentContainer
kotlin.Any
   ↳ android.app.FragmentContainer
   ↳ android.app.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.

Summary

Public constructors
FragmentHostCallback(context: Context!, handler: Handler!, windowAnimations: Int)

Public methods
open Unit

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

open Unit
onDump(prefix: String!, fd: FileDescriptor!, writer: PrintWriter!, args: Array<String!>!)

Print internal state into the given stream.

open T?

Return the view with the given resource ID.

abstract E?

Return the object that's currently hosting the fragment.

open LayoutInflater!

Return a LayoutInflater.

open Int

Return the window animations.

open Boolean

open Boolean

Return true if there are window animations.

open Unit

Invalidates the activity's options menu.

open Unit
onRequestPermissionsFromFragment(fragment: Fragment, permissions: Array<String!>, requestCode: Int)

Requests permissions from the given fragment.

open Boolean

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

open Unit
onStartActivityFromFragment(fragment: Fragment!, intent: Intent!, requestCode: Int, options: Bundle!)

Starts a new Activity from the given fragment.

open Unit
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.

open Boolean

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

Public constructors

FragmentHostCallback

Added in API level 23
FragmentHostCallback(
    context: Context!,
    handler: Handler!,
    windowAnimations: Int)

Public methods

onAttachFragment

Added in API level 23
open fun onAttachFragment(fragment: Fragment!): Unit

Deprecated: Deprecated in Java.

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

onDump

Added in API level 23
open fun onDump(
    prefix: String!,
    fd: FileDescriptor!,
    writer: PrintWriter!,
    args: Array<String!>!
): Unit

Deprecated: Deprecated in Java.

Print internal state into the given stream.

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

onFindViewById

Added in API level 23
open fun <T : View!> onFindViewById(id: Int): T?

Deprecated: Deprecated in Java.

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

Return
T? This value may be null.

onGetHost

Added in API level 23
abstract fun onGetHost(): E?

Deprecated: Deprecated in Java.

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 Fragment.getActivity().

Return
E? This value may be null.

onGetLayoutInflater

Added in API level 23
open fun onGetLayoutInflater(): LayoutInflater!

Deprecated: Deprecated in Java.

Return a LayoutInflater. See Activity.getLayoutInflater().

onGetWindowAnimations

Added in API level 23
open fun onGetWindowAnimations(): Int

Deprecated: Deprecated in Java.

Return the window animations.

onHasView

Added in API level 23
open fun onHasView(): Boolean

Deprecated: Deprecated in Java.

onHasWindowAnimations

Added in API level 23
open fun onHasWindowAnimations(): Boolean

Deprecated: Deprecated in Java.

Return true if there are window animations.

onInvalidateOptionsMenu

Added in API level 23
open fun onInvalidateOptionsMenu(): Unit

Deprecated: Deprecated in Java.

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

onRequestPermissionsFromFragment

Added in API level 23
open fun onRequestPermissionsFromFragment(
    fragment: Fragment,
    permissions: Array<String!>,
    requestCode: Int
): Unit

Deprecated: Deprecated in Java.

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

Parameters
fragment Fragment: This value cannot be null.
permissions Array<String!>: This value cannot be null.

onShouldSaveFragmentState

Added in API level 23
open fun onShouldSaveFragmentState(fragment: Fragment!): Boolean

Deprecated: Deprecated in Java.

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

onStartActivityFromFragment

Added in API level 23
open fun onStartActivityFromFragment(
    fragment: Fragment!,
    intent: Intent!,
    requestCode: Int,
    options: Bundle!
): Unit

Deprecated: Deprecated in Java.

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

onStartIntentSenderFromFragment

Added in API level 24
Deprecated in API level 28
open fun onStartIntentSenderFromFragment(
    fragment: Fragment!,
    intent: IntentSender!,
    requestCode: Int,
    fillInIntent: Intent?,
    flagsMask: Int,
    flagsValues: Int,
    extraFlags: Int,
    options: Bundle!
): Unit

Deprecated: Deprecated in Java.

Starts a new IntentSender from the given fragment. See android.app.Activity#startIntentSender(android.content.IntentSender,android.content.Intent,int,int,int,android.os.Bundle).

Parameters
fillInIntent Intent?: This value may be null.

onUseFragmentManagerInflaterFactory

Added in API level 23
open fun onUseFragmentManagerInflaterFactory(): Boolean

Deprecated: Deprecated in Java.

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