Share via


ActivityManager.AddAppTask Method

Definition

Add a new AppTask for the calling application.

[Android.Runtime.Register("addAppTask", "(Landroid/app/Activity;Landroid/content/Intent;Landroid/app/ActivityManager$TaskDescription;Landroid/graphics/Bitmap;)I", "GetAddAppTask_Landroid_app_Activity_Landroid_content_Intent_Landroid_app_ActivityManager_TaskDescription_Landroid_graphics_Bitmap_Handler")]
public virtual int AddAppTask (Android.App.Activity activity, Android.Content.Intent intent, Android.App.ActivityManager.TaskDescription? description, Android.Graphics.Bitmap thumbnail);
[<Android.Runtime.Register("addAppTask", "(Landroid/app/Activity;Landroid/content/Intent;Landroid/app/ActivityManager$TaskDescription;Landroid/graphics/Bitmap;)I", "GetAddAppTask_Landroid_app_Activity_Landroid_content_Intent_Landroid_app_ActivityManager_TaskDescription_Landroid_graphics_Bitmap_Handler")>]
abstract member AddAppTask : Android.App.Activity * Android.Content.Intent * Android.App.ActivityManager.TaskDescription * Android.Graphics.Bitmap -> int
override this.AddAppTask : Android.App.Activity * Android.Content.Intent * Android.App.ActivityManager.TaskDescription * Android.Graphics.Bitmap -> int

Parameters

activity
Activity

The activity that is adding the entry. This is used to help determine the context that the new recents entry will be in.

intent
Intent

The Intent that describes the recents entry. This is the same Intent that you would have used to launch the activity for it. In generally you will want to set both Intent#FLAG_ACTIVITY_NEW_DOCUMENT and Intent#FLAG_ACTIVITY_RETAIN_IN_RECENTS; the latter is required since this recents entry will exist without an activity, so it doesn't make sense to not retain it when its activity disappears. The given Intent here also must have an explicit ComponentName set on it.

description
ActivityManager.TaskDescription

Optional additional description information.

thumbnail
Bitmap

Thumbnail to use for the recents entry. Should be the size given by #getAppTaskThumbnailSize(). If the bitmap is not that exact size, it will be recreated in your process, probably in a way you don't like, before the recents entry is added.

Returns

Returns the task id of the newly added app task, or -1 if the add failed. The most likely cause of failure is that there is no more room for more tasks for your app.

Attributes

Remarks

Java documentation for android.app.ActivityManager.addAppTask(android.app.Activity, android.content.Intent, android.app.TaskDescription, android.graphics.Bitmap).

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