FragmentTransaction.Add Method

Definition

Overloads

Name Description
Add(Fragment, String)

Calls add(int,Fragment,String) with a 0 containerViewId.

Add(Int32, Fragment)

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

Add(Int32, Fragment, String)

Add a fragment to the activity state.

Add(Fragment, String)

Calls add(int,Fragment,String) with a 0 containerViewId.

[Android.Runtime.Register("add", "(Landroid/app/Fragment;Ljava/lang/String;)Landroid/app/FragmentTransaction;", "GetAdd_Landroid_app_Fragment_Ljava_lang_String_Handler")]
public abstract Android.App.FragmentTransaction? Add(Android.App.Fragment? fragment, string? tag);
[<Android.Runtime.Register("add", "(Landroid/app/Fragment;Ljava/lang/String;)Landroid/app/FragmentTransaction;", "GetAdd_Landroid_app_Fragment_Ljava_lang_String_Handler")>]
abstract member Add : Android.App.Fragment * string -> Android.App.FragmentTransaction

Parameters

fragment
Fragment

Fragment

tag
String

String

Returns

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

Attributes

Remarks

Calls add(int,Fragment,String) with a 0 containerViewId.

Android reference for android.app.FragmentTransaction.add.

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

Add(Int32, Fragment)

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

[Android.Runtime.Register("add", "(ILandroid/app/Fragment;)Landroid/app/FragmentTransaction;", "GetAdd_ILandroid_app_Fragment_Handler")]
public abstract Android.App.FragmentTransaction? Add(int containerViewId, Android.App.Fragment? fragment);
[<Android.Runtime.Register("add", "(ILandroid/app/Fragment;)Landroid/app/FragmentTransaction;", "GetAdd_ILandroid_app_Fragment_Handler")>]
abstract member Add : 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 add(int,Fragment,String) with a null tag.

Android reference for android.app.FragmentTransaction.add.

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

Add(Int32, Fragment, String)

Add a fragment to the activity state.

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

Parameters

containerViewId
Int32

int: Optional identifier of the container this fragment is to be placed in. If 0, it will not be placed in a container.

fragment
Fragment

Fragment: The fragment to be added. This fragment must not already be added to the activity.

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

Add a fragment to the activity state. This fragment may optionally also have its view (if Fragment.onCreateView returns non-null) inserted into a container view of the activity.

Android reference for android.app.FragmentTransaction.add.

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