Android Guides | Samples

Android.Content.ActivityFlags Enumeration

Enumerates values returned by several types and taken as a parameter of several types.

Syntax

[System.Flags]
public enum ActivityFlags

Remarks

Enumerates values returned by the following: and taken as a parameter of the following: .

Members

Member NameDescription
BroughtToFrontThis flag is not normally set by application code, but set for you by the system as described in the NoType:android/R$styleable;Href=../../../reference/android/R.styleable.html#AndroidManifestActivity_launchMode documentation for the singleTask mode.
ClearTaskIf set in an Intent passed to Context.StartActivity(Intent), this flag will cause any existing task that would be associated with the activity to be cleared before the activity is started. That is, the activity becomes the new root of an otherwise empty task, and any old activities are finished. This can only be used in conjunction with ActivityFlags.NewTask.
ClearTop

ActivityFlags.SingleTopActivityFlags.SingleTop

ActivityFlags.NewTask

See Tasks and Back Stack for more information about tasks.

ClearWhenTaskReset

ActivityFlags.ResetTaskIfNeeded

This is useful for cases where you have a logical break in your application. For example, an e-mail application may have a command to view an attachment, which launches an image view activity to display it. This activity should be part of the e-mail application's task, since it is a part of the task the user is involved in. However, if the user leaves that task, and later selects the e-mail app from home, we may like them to return to the conversation they were viewing, not the picture attachment, since that is confusing. By setting this flag when launching the image viewer, that viewer and any activities it starts will be removed the next time the user returns to mail.

DebugLogResolutionA flag you can enable for debugging: when set, log messages will be printed during the resolution of this intent to show you what has been found to create the final resolved list.
ExcludeFromRecentsIf set, the new activity is not kept in the list of recently launched activities.
ExcludeStoppedPackagesIf set, this intent will not match any components in packages that are currently stopped. If this is not set, then the default behavior is to include such applications in the result.
ForwardResultIf set and this intent is being used to launch a new activity from an existing one, then the reply target of the existing activity will be transfered to the new activity. This way the new activity can call Activity.SetResult(Result) and have that result sent back to the reply target of the original activity.
FromBackgroundCan be set by the caller to indicate that this Intent is coming from a background operation, not from direct user interaction.
GrantPersistableUriPermission
GrantPrefixUriPermission
GrantReadUriPermissionIf set, the recipient of this Intent will be granted permission to perform read operations on the Uri in the Intent's data and any URIs specified in its ClipData. When applying to an Intent's ClipData, all URIs as well as recursive traversals through data or other ClipData in Intent items will be granted; only the grant flags of the top-level Intent are used.
GrantWriteUriPermissionIf set, the recipient of this Intent will be granted permission to perform write operations on the Uri in the Intent's data and any URIs specified in its ClipData. When applying to an Intent's ClipData, all URIs as well as recursive traversals through data or other ClipData in Intent items will be granted; only the grant flags of the top-level Intent are used.
IncludeStoppedPackagesIf set, this intent will always match any components in packages that are currently stopped. This is the default behavior when ActivityFlags.ExcludeStoppedPackages is not set. If both of these flags are set, this one wins (it allows overriding of exclude for places where the framework may automatically set the exclude flag).
LaunchedFromHistoryThis flag is not normally set by application code, but set for you by the system if this activity is being launched from history (longpress home key).
MultipleTask

Do not use this flag unless you are implementing your own top-level application launcher.ActivityFlags.NewTaskalways

Because the default system does not include graphical task management, you should not use this flag unless you provide some way for a user to return back to the tasks you have launched.

ActivityFlags.NewTask

See Tasks and Back Stack for more information about tasks.

NewDocument
NewTask

Tasks and Back Stack

ActivityFlags.MultipleTask

This flag can not be used when the caller is requesting a result from the activity being launched.

NoAnimationIf set in an Intent passed to Context.StartActivity(Intent), this flag will prevent the system from applying an activity transition animation to go to the next activity state. This doesn't mean an animation will never run -- if another activity change happens that doesn't specify this flag before the activity started here is displayed, then that transition will be used. This flag can be put to good use when you are going to do a series of activity operations but the animation seen by the user shouldn't be driven by the first activity change but rather a later one.
NoHistoryIf set, the new activity is not kept in the history stack. As soon as the user navigates away from it, the activity is finished. This may also be set with the NoType:android/R$styleable;Href=../../../reference/android/R.styleable.html#AndroidManifestActivity_noHistory attribute.
NoUserAction

Activity.OnUserLeaveHint

If an activity is ever started via any non-user-driven events such as phone-call receipt or an alarm handler, this flag should be passed to Context.StartActivity(Intent), ensuring that the pausing activity does not think the user has acknowledged its notification.

PreviousIsTopIf set and this intent is being used to launch a new activity from an existing one, the current activity will not be counted as the top activity for deciding whether the new intent should be delivered to the top instead of starting a new one. The previous activity will be used as the top, with the assumption being that the current activity will finish itself immediately.
ReceiverForegroundIf set, when sending a broadcast the recipient is allowed to run at foreground priority, with a shorter timeout interval. During normal broadcasts the receivers are not automatically hoisted out of the background priority class.
ReceiverNoAbort
ReceiverRegisteredOnlyIf set, when sending a broadcast only registered receivers will be called -- no BroadcastReceiver components will be launched.
ReceiverReplacePending

Intent.FilterEquals(Intent)

This flag is most typically used with sticky broadcasts, which only care about delivering the most recent values of the broadcast to their receivers.

ReorderToFront

Context.StartActivity(Intent)

For example, consider a task consisting of four activities: A, B, C, D. If D calls startActivity() with an Intent that resolves to the component of activity B, then B will be brought to the front of the history stack, with this resulting order: A, C, D, B. This flag will be ignored if ActivityFlags.ClearTop is also specified.

ResetTaskIfNeededIf set, and this activity is either being started in a new task or bringing to the top an existing task, then it will be launched as the front door of the task. This will result in the application of any affinities needed to have that task in the proper state (either moving activities to or from it), or simply resetting that task to its initial state if needed.
RetainInRecents
SingleTopIf set, the activity will not be launched if it is already running at the top of the history stack.
TaskOnHomeIf set in an Intent passed to Context.StartActivity(Intent), this flag will cause a newly launching task to be placed on top of the current home activity task (if there is one). That is, pressing back from the task will always return the user to home even if that was not the last activity they saw. This can only be used in conjunction with ActivityFlags.NewTask.

Requirements

Namespace: Android.Content
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0

The members of Android.Content.ActivityFlags are listed below.

See Also: Enum

Public Fields

BroughtToFrontActivityFlags. This flag is not normally set by application code, but set for you by the system as described in the NoType:android/R$styleable;Href=../../../reference/android/R.styleable.html#AndroidManifestActivity_launchMode documentation for the singleTask mode.
ClearTaskActivityFlags. If set in an Intent passed to Context.StartActivity(Intent), this flag will cause any existing task that would be associated with the activity to be cleared before the activity is started. That is, the activity becomes the new root of an otherwise empty task, and any old activities are finished. This can only be used in conjunction with ActivityFlags.NewTask.
ClearTopActivityFlags.

ActivityFlags.SingleTopActivityFlags.SingleTop

ActivityFlags.NewTask

See Tasks and Back Stack for more information about tasks.

ClearWhenTaskResetActivityFlags.

ActivityFlags.ResetTaskIfNeeded

This is useful for cases where you have a logical break in your application. For example, an e-mail application may have a command to view an attachment, which launches an image view activity to display it. This activity should be part of the e-mail application's task, since it is a part of the task the user is involved in. However, if the user leaves that task, and later selects the e-mail app from home, we may like them to return to the conversation they were viewing, not the picture attachment, since that is confusing. By setting this flag when launching the image viewer, that viewer and any activities it starts will be removed the next time the user returns to mail.

DebugLogResolutionActivityFlags. A flag you can enable for debugging: when set, log messages will be printed during the resolution of this intent to show you what has been found to create the final resolved list.
ExcludeFromRecentsActivityFlags. If set, the new activity is not kept in the list of recently launched activities.
ExcludeStoppedPackagesActivityFlags. If set, this intent will not match any components in packages that are currently stopped. If this is not set, then the default behavior is to include such applications in the result.
ForwardResultActivityFlags. If set and this intent is being used to launch a new activity from an existing one, then the reply target of the existing activity will be transfered to the new activity. This way the new activity can call Activity.SetResult(Result) and have that result sent back to the reply target of the original activity.
FromBackgroundActivityFlags. Can be set by the caller to indicate that this Intent is coming from a background operation, not from direct user interaction.
GrantPersistableUriPermissionActivityFlags.
GrantPrefixUriPermissionActivityFlags.
GrantReadUriPermissionActivityFlags. If set, the recipient of this Intent will be granted permission to perform read operations on the Uri in the Intent's data and any URIs specified in its ClipData. When applying to an Intent's ClipData, all URIs as well as recursive traversals through data or other ClipData in Intent items will be granted; only the grant flags of the top-level Intent are used.
GrantWriteUriPermissionActivityFlags. If set, the recipient of this Intent will be granted permission to perform write operations on the Uri in the Intent's data and any URIs specified in its ClipData. When applying to an Intent's ClipData, all URIs as well as recursive traversals through data or other ClipData in Intent items will be granted; only the grant flags of the top-level Intent are used.
IncludeStoppedPackagesActivityFlags. If set, this intent will always match any components in packages that are currently stopped. This is the default behavior when ActivityFlags.ExcludeStoppedPackages is not set. If both of these flags are set, this one wins (it allows overriding of exclude for places where the framework may automatically set the exclude flag).
LaunchedFromHistoryActivityFlags. This flag is not normally set by application code, but set for you by the system if this activity is being launched from history (longpress home key).
MultipleTaskActivityFlags.

Do not use this flag unless you are implementing your own top-level application launcher.ActivityFlags.NewTaskalways

Because the default system does not include graphical task management, you should not use this flag unless you provide some way for a user to return back to the tasks you have launched.

ActivityFlags.NewTask

See Tasks and Back Stack for more information about tasks.

NewDocumentActivityFlags.
NewTaskActivityFlags.

Tasks and Back Stack

ActivityFlags.MultipleTask

This flag can not be used when the caller is requesting a result from the activity being launched.

NoAnimationActivityFlags. If set in an Intent passed to Context.StartActivity(Intent), this flag will prevent the system from applying an activity transition animation to go to the next activity state. This doesn't mean an animation will never run -- if another activity change happens that doesn't specify this flag before the activity started here is displayed, then that transition will be used. This flag can be put to good use when you are going to do a series of activity operations but the animation seen by the user shouldn't be driven by the first activity change but rather a later one.
NoHistoryActivityFlags. If set, the new activity is not kept in the history stack. As soon as the user navigates away from it, the activity is finished. This may also be set with the NoType:android/R$styleable;Href=../../../reference/android/R.styleable.html#AndroidManifestActivity_noHistory attribute.
NoUserActionActivityFlags.

Activity.OnUserLeaveHint

If an activity is ever started via any non-user-driven events such as phone-call receipt or an alarm handler, this flag should be passed to Context.StartActivity(Intent), ensuring that the pausing activity does not think the user has acknowledged its notification.

PreviousIsTopActivityFlags. If set and this intent is being used to launch a new activity from an existing one, the current activity will not be counted as the top activity for deciding whether the new intent should be delivered to the top instead of starting a new one. The previous activity will be used as the top, with the assumption being that the current activity will finish itself immediately.
ReceiverForegroundActivityFlags. If set, when sending a broadcast the recipient is allowed to run at foreground priority, with a shorter timeout interval. During normal broadcasts the receivers are not automatically hoisted out of the background priority class.
ReceiverNoAbortActivityFlags.
ReceiverRegisteredOnlyActivityFlags. If set, when sending a broadcast only registered receivers will be called -- no BroadcastReceiver components will be launched.
ReceiverReplacePendingActivityFlags.

Intent.FilterEquals(Intent)

This flag is most typically used with sticky broadcasts, which only care about delivering the most recent values of the broadcast to their receivers.

ReorderToFrontActivityFlags.

Context.StartActivity(Intent)

For example, consider a task consisting of four activities: A, B, C, D. If D calls startActivity() with an Intent that resolves to the component of activity B, then B will be brought to the front of the history stack, with this resulting order: A, C, D, B. This flag will be ignored if ActivityFlags.ClearTop is also specified.

ResetTaskIfNeededActivityFlags. If set, and this activity is either being started in a new task or bringing to the top an existing task, then it will be launched as the front door of the task. This will result in the application of any affinities needed to have that task in the proper state (either moving activities to or from it), or simply resetting that task to its initial state if needed.
RetainInRecentsActivityFlags.
SingleTopActivityFlags. If set, the activity will not be launched if it is already running at the top of the history stack.
TaskOnHomeActivityFlags. If set in an Intent passed to Context.StartActivity(Intent), this flag will cause a newly launching task to be placed on top of the current home activity task (if there is one). That is, pressing back from the task will always return the user to home even if that was not the last activity they saw. This can only be used in conjunction with ActivityFlags.NewTask.