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

Activity: The activity that is adding the entry. This is used to help determine the context that the new recents entry will be in. This value cannot be null.

intent
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. This value cannot be null.

description
ActivityManager.TaskDescription

ActivityManager.TaskDescription: Optional additional description information. This value may be null.

thumbnail
Bitmap

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. This value cannot be null.

Returns

Attributes

Remarks

Add a new AppTask for the calling application. This will create a new recents entry that is added to the end of all existing recents.

Android reference for android.app.ActivityManager.addAppTask.

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