다음을 통해 공유


AsyncTask.Execute Method

Definition

Overloads

Execute(IRunnable)

Convenience version of #execute(Object...) for use with a simple Runnable object.

Execute(Object[])

Executes the task with the specified parameters.

Execute(IRunnable)

Convenience version of #execute(Object...) for use with a simple Runnable object.

[Android.Runtime.Register("execute", "(Ljava/lang/Runnable;)V", "")]
public static void Execute (Java.Lang.IRunnable? runnable);
[<Android.Runtime.Register("execute", "(Ljava/lang/Runnable;)V", "")>]
static member Execute : Java.Lang.IRunnable -> unit

Parameters

runnable
IRunnable
Attributes

Remarks

Convenience version of #execute(Object...) for use with a simple Runnable object. See #execute(Object[]) for more information on the order of execution.

Java documentation for android.os.AsyncTask.execute(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

Execute(Object[])

Executes the task with the specified parameters.

[Android.Runtime.Register("execute", "([Ljava/lang/Object;)Landroid/os/AsyncTask;", "")]
public Android.OS.AsyncTask? Execute (params Java.Lang.Object[]? params);
[<Android.Runtime.Register("execute", "([Ljava/lang/Object;)Landroid/os/AsyncTask;", "")>]
member this.Execute : Java.Lang.Object[] -> Android.OS.AsyncTask

Parameters

params
Object[]

The parameters of the task.

Returns

This instance of AsyncTask.

Attributes

Remarks

Executes the task with the specified parameters. The task returns itself (this) so that the caller can keep a reference to it.

Note: this function schedules the task on a queue for a single background thread or pool of threads depending on the platform version. When first introduced, AsyncTasks were executed serially on a single background thread. Starting with android.os.Build.VERSION_CODES#DONUT, this was changed to a pool of threads allowing multiple tasks to operate in parallel. Starting android.os.Build.VERSION_CODES#HONEYCOMB, tasks are back to being executed on a single thread to avoid common application errors caused by parallel execution. If you truly want parallel execution, you can use the #executeOnExecutor version of this method with #THREAD_POOL_EXECUTOR; however, see commentary there for warnings on its use.

This method must be invoked on the UI thread.

Java documentation for android.os.AsyncTask.execute(Params...).

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