Language

FragmentManager.GetFragment Method

Definition

Overloads

Name Description
GetFragment(Bundle, String)

Retrieve the current Fragment instance for a reference previously placed with #putFragment(Bundle, String, Fragment).

GetFragment<T>(Bundle, String)

Retrieves the current Fragment instance for a reference previously placed in bundle with PutFragment, and returns it cast to T.

GetFragment(Bundle, String)

Retrieve the current Fragment instance for a reference previously placed with #putFragment(Bundle, String, Fragment).

[Android.Runtime.Register("getFragment", "(Landroid/os/Bundle;Ljava/lang/String;)Landroid/app/Fragment;", "GetGetFragment_Landroid_os_Bundle_Ljava_lang_String_Handler")]
public abstract Android.App.Fragment? GetFragment(Android.OS.Bundle? bundle, string? key);
[<Android.Runtime.Register("getFragment", "(Landroid/os/Bundle;Ljava/lang/String;)Landroid/app/Fragment;", "GetGetFragment_Landroid_os_Bundle_Ljava_lang_String_Handler")>]
abstract member GetFragment : Android.OS.Bundle * string -> Android.App.Fragment

Parameters

bundle
Bundle

The bundle from which to retrieve the fragment reference.

key
String

The name of the entry in the bundle.

Returns

Returns the current Fragment instance that is associated with the given reference.

Attributes

Remarks

Retrieve the current Fragment instance for a reference previously placed with putFragment(Bundle,String,Fragment).

Android reference for android.app.FragmentManager.getFragment.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

GetFragment<T>(Bundle, String)

Retrieves the current Fragment instance for a reference previously placed in bundle with PutFragment, and returns it cast to T.

public T? GetFragment<T>(Android.OS.Bundle bundle, string key) where T : Android.App.Fragment;
member this.GetFragment : Android.OS.Bundle * string -> 'T (requires 'T :> Android.App.Fragment)

Type Parameters

T

The Fragment type to cast the result to.

Parameters

bundle
Bundle

The bundle in which the fragment reference was stored.

key
String

The name of the entry in the bundle.

Returns

T

The referenced fragment cast to T, or null if no fragment is associated with the given key.

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to