Partager via


FragmentTransaction.SetPrimaryNavigationFragment(Fragment) Method

Definition

Set a currently active fragment in this FragmentManager as the primary navigation fragment.

[Android.Runtime.Register("setPrimaryNavigationFragment", "(Landroid/app/Fragment;)Landroid/app/FragmentTransaction;", "GetSetPrimaryNavigationFragment_Landroid_app_Fragment_Handler", ApiSince=26)]
public abstract Android.App.FragmentTransaction? SetPrimaryNavigationFragment (Android.App.Fragment? fragment);
[<Android.Runtime.Register("setPrimaryNavigationFragment", "(Landroid/app/Fragment;)Landroid/app/FragmentTransaction;", "GetSetPrimaryNavigationFragment_Landroid_app_Fragment_Handler", ApiSince=26)>]
abstract member SetPrimaryNavigationFragment : Android.App.Fragment -> Android.App.FragmentTransaction

Parameters

fragment
Fragment

the fragment to set as the primary navigation fragment

Returns

the same FragmentTransaction instance

Attributes

Remarks

Set a currently active fragment in this FragmentManager as the primary navigation fragment.

The primary navigation fragment's Fragment#getChildFragmentManager() child FragmentManager will be called first to process delegated navigation actions such as FragmentManager#popBackStack() if no ID or transaction name is provided to pop to. Navigation operations outside of the fragment system may choose to delegate those actions to the primary navigation fragment as returned by FragmentManager#getPrimaryNavigationFragment().

The fragment provided must currently be added to the FragmentManager to be set as a primary navigation fragment, or previously added as part of this transaction.

Java documentation for android.app.FragmentTransaction.setPrimaryNavigationFragment(android.app.Fragment).

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