Udostępnij za pośrednictwem


FragmentTransaction.RunOnCommit(IRunnable) Method

Definition

Add a Runnable to this transaction that will be run after this transaction has been committed.

[Android.Runtime.Register("runOnCommit", "(Ljava/lang/Runnable;)Landroid/app/FragmentTransaction;", "GetRunOnCommit_Ljava_lang_Runnable_Handler", ApiSince=26)]
public abstract Android.App.FragmentTransaction? RunOnCommit (Java.Lang.IRunnable? runnable);
[<Android.Runtime.Register("runOnCommit", "(Ljava/lang/Runnable;)Landroid/app/FragmentTransaction;", "GetRunOnCommit_Ljava_lang_Runnable_Handler", ApiSince=26)>]
abstract member RunOnCommit : Java.Lang.IRunnable -> Android.App.FragmentTransaction

Parameters

runnable
IRunnable

Runnable to add

Returns

this FragmentTransaction

Attributes

Remarks

Add a Runnable to this transaction that will be run after this transaction has been committed. If fragment transactions are #setReorderingAllowed(boolean) optimized this may be after other subsequent fragment operations have also taken place, or operations in this transaction may have been optimized out due to the presence of a subsequent fragment transaction in the batch.

If a transaction is committed using #commitAllowingStateLoss() this runnable may be executed when the FragmentManager is in a state where new transactions may not be committed without allowing state loss.

runOnCommit may not be used with transactions #addToBackStack(String) added to the back stack as Runnables cannot be persisted with back stack state. IllegalStateException will be thrown if #addToBackStack(String) has been previously called for this transaction or if it is called after a call to runOnCommit.

Java documentation for android.app.FragmentTransaction.runOnCommit(java.lang.Runnable).

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