PreferenceHeaderFragmentCompat  |  API reference  |  Android Developers

void

Print the Fragments's state into the given stream.

final @Nullable FragmentActivity boolean boolean final @Nullable Bundle final @NonNull FragmentManager @Nullable Context @NonNull CreationExtras @NonNull ViewModelProvider.Factory @Nullable Object @Nullable Object final @Nullable FragmentManager

This method is deprecated. Deprecated in Java

final @Nullable Object final int final @NonNull LayoutInflater @NonNull Lifecycle @NonNull LoaderManager

This method is deprecated. Deprecated in Java

final @Nullable Fragment final @NonNull FragmentManager @Nullable Object final @NonNull Resources final boolean

This method is deprecated. Deprecated in Java

@Nullable Object final @NonNull SavedStateRegistry @Nullable Object @Nullable Object final @NonNull String

Return a localized string from the application's package's default string table.

final @NonNull String

Return a localized formatted string from the application's package's default string table, substituting the format arguments as defined in java.util.Formatter and format.

final @Nullable String final @Nullable Fragment

This method is deprecated. Deprecated in Java

final int

This method is deprecated. Deprecated in Java

final @NonNull CharSequence

Return a localized, styled CharSequence from the application's package's default string table.

boolean

This method is deprecated. Deprecated in Java

@Nullable View @NonNull LifecycleOwner @NonNull LiveData<@NonNull LifecycleOwner> @NonNull ViewModelStore final boolean final boolean final boolean final boolean final boolean final boolean final boolean final boolean void

This method is deprecated.

use onViewCreated for code touching the view created by onCreateView and onCreate for other initialization.

void

This method is deprecated.

This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an ActivityResultContract and the prebuilt contracts for common intents available in androidx.activity.result.contract.ActivityResultContracts, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment.

void

This method is deprecated.

See onAttach.

void

This method is deprecated.

The responsibility for listening for fragments being attached has been moved to FragmentManager.

boolean

This hook is called whenever an item in a context menu is selected.

void

Called to do initial creation of a fragment.

@Nullable Animation

Called when a fragment loads an animation.

@Nullable Animator

Called when a fragment loads an animator.

void

This method is deprecated.

androidx.activity.ComponentActivity now implements MenuHost, an interface that allows any component, including your activity itself, to add menu items by calling addMenuProvider without forcing all components through this single method override.

void

Called when the fragment is no longer in use.

void

This method is deprecated.

androidx.activity.ComponentActivity now implements MenuHost, an interface that allows any component, including your activity itself, to add menu items by calling addMenuProvider without forcing all components through this single method override.

void

Called when the view previously created by onCreateView has been detached from the fragment.

void

Called when the fragment is no longer attached to its activity.

@NonNull LayoutInflater

Returns the LayoutInflater used to inflate Views of this Fragment.

void

Called when the hidden state (as returned by isHidden of the fragment or another fragment in its hierarchy has changed.

void

This method is deprecated.

See onInflate.

void

Called when a fragment is being created as part of a view layout inflation, typically from setting the content view of an activity.

void

Called when the Fragment's activity changes from fullscreen mode to multi-window mode and visa-versa.

boolean

This method is deprecated.

androidx.activity.ComponentActivity now implements MenuHost, an interface that allows any component, including your activity itself, to add menu items by calling addMenuProvider without forcing all components through this single method override.

void

This method is deprecated.

androidx.activity.ComponentActivity now implements MenuHost, an interface that allows any component, including your activity itself, to add menu items by calling addMenuProvider without forcing all components through this single method override.

void

Called when the Fragment is no longer resumed.

void

Called by the system when the activity changes to and from picture-in-picture mode.

void

This method is deprecated.

androidx.activity.ComponentActivity now implements MenuHost, an interface that allows any component, including your activity itself, to add menu items by calling addMenuProvider without forcing all components through this single method override.

void

Callback for when the primary navigation state of this Fragment has changed.

void

This method is deprecated.

This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an ActivityResultContract and the prebuilt contracts for common intents available in androidx.activity.result.contract.ActivityResultContracts, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment.

void

Called when the fragment is visible to the user and actively running.

void

Called to ask the fragment to save its current dynamic state, so it can later be reconstructed in a new instance if its process is restarted.

void

Called when the Fragment is visible to the user.

void

Called when the Fragment is no longer started.

void

Postpone the entering Fragment transition until startPostponedEnterTransition or executePendingTransactions has been called.

final void

Postpone the entering Fragment transition for a given amount of time and then call startPostponedEnterTransition.

void

Registers a context menu to be shown for the given view (multiple views can show the context menu).

final void

This method is deprecated.

This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an ActivityResultContract and the prebuilt contracts for common intents available in androidx.activity.result.contract.ActivityResultContracts, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment.

final @NonNull FragmentActivity

Return the FragmentActivity this fragment is currently associated with.

final @NonNull Bundle

Return the arguments supplied when the fragment was instantiated.

final @NonNull Context

Return the Context this fragment is currently associated with.

final @NonNull FragmentManager

This method is deprecated.

This has been renamed to getParentFragmentManager() to make it clear that you are accessing the FragmentManager that contains this Fragment and not the FragmentManager associated with child Fragments.

final @NonNull Object

Return the host object of this fragment.

final @NonNull Fragment

Returns the parent Fragment containing this Fragment.

final @NonNull View

Get the root view for the fragment's layout (the one returned by onCreateView).

void void void void

When custom transitions are used with Fragments, the enter transition callback is called when this Fragment is attached or detached when not popping the back stack.

void void

When custom transitions are used with Fragments, the exit transition callback is called when this Fragment is attached or detached when popping the back stack.

void void

This method is deprecated.

This method is no longer needed when using a MenuProvider to provide a Menu to your activity, which replaces onCreateOptionsMenu as the recommended way to provide a consistent, optionally Lifecycle-aware, and modular way to handle menu creation and item selection.

void

Set the initial saved state that this Fragment should restore itself from when first being constructed, as returned by FragmentManager.saveFragmentInstanceState.

void

Set a hint for whether this fragment's menu should be visible.

void void

This method is deprecated. Deprecated in Java

void void void void

This method is deprecated.

Instead of using a target fragment to pass results, the fragment requesting a result should use setFragmentResultListener to register a FragmentResultListener with a requestKey using its parent fragment manager.

void

This method is deprecated. Deprecated in Java

boolean

Gets whether you should show UI with rationale before requesting a permission.

void

Call startActivity from the fragment's containing Activity.

void

Call startActivity from the fragment's containing Activity.

void

This method is deprecated.

This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an ActivityResultContract and the prebuilt contracts for common intents available in androidx.activity.result.contract.ActivityResultContracts, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment.

void

This method is deprecated.

This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an ActivityResultContract and the prebuilt contracts for common intents available in androidx.activity.result.contract.ActivityResultContracts, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment.

void

This method is deprecated.

This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an ActivityResultContract and the prebuilt contracts for common intents available in androidx.activity.result.contract.ActivityResultContracts, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment.

void

Begin postponed transitions after postponeEnterTransition was called.

void

Prevents a context menu to be shown for the given view.