FragmentTransaction.Replace Method

Definition

Overloads

Name Description
Replace(Int32, Fragment)

Calls replace(int,Fragment,String) with a null tag.

Replace(Int32, Fragment, String)

Replace an existing fragment that was added to a container.

Replace(Int32, Fragment)

Calls replace(int,Fragment,String) with a null tag.

[Android.Runtime.Register("replace", "(ILandroid/app/Fragment;)Landroid/app/FragmentTransaction;", "GetReplace_ILandroid_app_Fragment_Handler")]
public abstract Android.App.FragmentTransaction? Replace(int containerViewId, Android.App.Fragment? fragment);
[<Android.Runtime.Register("replace", "(ILandroid/app/Fragment;)Landroid/app/FragmentTransaction;", "GetReplace_ILandroid_app_Fragment_Handler")>]
abstract member Replace : int * Android.App.Fragment -> Android.App.FragmentTransaction

Parameters

containerViewId
Int32

int

fragment
Fragment

Fragment

Returns

The same FragmentTransaction instance, allowing additional transaction operations to be chained.

Attributes

Remarks

Calls replace(int,Fragment,String) with a null tag.

Android reference for android.app.FragmentTransaction.replace.

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

Replace(Int32, Fragment, String)

Replace an existing fragment that was added to a container.

[Android.Runtime.Register("replace", "(ILandroid/app/Fragment;Ljava/lang/String;)Landroid/app/FragmentTransaction;", "GetReplace_ILandroid_app_Fragment_Ljava_lang_String_Handler")]
public abstract Android.App.FragmentTransaction? Replace(int containerViewId, Android.App.Fragment? fragment, string? tag);
[<Android.Runtime.Register("replace", "(ILandroid/app/Fragment;Ljava/lang/String;)Landroid/app/FragmentTransaction;", "GetReplace_ILandroid_app_Fragment_Ljava_lang_String_Handler")>]
abstract member Replace : int * Android.App.Fragment * string -> Android.App.FragmentTransaction

Parameters

containerViewId
Int32

int: Identifier of the container whose fragment(s) are to be replaced.

fragment
Fragment

Fragment: The new fragment to place in the container.

tag
String

String: Optional tag name for the fragment, to later retrieve the fragment with FragmentManager.findFragmentByTag(String).

Returns

The same FragmentTransaction instance, allowing additional transaction operations to be chained.

Attributes

Remarks

Replace an existing fragment that was added to a container. This is essentially the same as calling remove(Fragment) for all currently added fragments that were added with the same containerViewId and then add(int,Fragment,String) with the same arguments given here.

Android reference for android.app.FragmentTransaction.replace.

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