Intent.ResolveActivity(PackageManager) Method

Definition

Return the Activity component that should be used to handle this intent.

[Android.Runtime.Register("resolveActivity", "(Landroid/content/pm/PackageManager;)Landroid/content/ComponentName;", "GetResolveActivity_Landroid_content_pm_PackageManager_Handler")]
public virtual Android.Content.ComponentName? ResolveActivity (Android.Content.PM.PackageManager pm);
[<Android.Runtime.Register("resolveActivity", "(Landroid/content/pm/PackageManager;)Landroid/content/ComponentName;", "GetResolveActivity_Landroid_content_pm_PackageManager_Handler")>]
abstract member ResolveActivity : Android.Content.PM.PackageManager -> Android.Content.ComponentName
override this.ResolveActivity : Android.Content.PM.PackageManager -> Android.Content.ComponentName

Parameters

pm
PackageManager

The package manager with which to resolve the Intent.

Returns

Name of the component implementing an activity that can display the intent.

Attributes

Remarks

Return the Activity component that should be used to handle this intent. The appropriate component is determined based on the information in the intent, evaluated as follows:

If #getComponent returns an explicit class, that is returned without any further consideration.

The activity must handle the Intent#CATEGORY_DEFAULT Intent category to be considered.

If #getAction is non-NULL, the activity must handle this action.

If #resolveType returns non-NULL, the activity must handle this type.

If #addCategory has added any categories, the activity must handle ALL of the categories specified.

If #getPackage is non-NULL, only activity components in that application package will be considered.

If there are no activities that satisfy all of these conditions, a null string is returned.

If multiple activities are found to satisfy the intent, the one with the highest priority will be used. If there are multiple activities with the same priority, the system will either pick the best activity based on user preference, or resolve to a system class that will allow the user to pick an activity and forward from there.

This method is implemented simply by calling PackageManager#resolveActivity with the "defaultOnly" parameter true.

This API is called for you as part of starting an activity from an intent. You do not normally need to call it yourself.

Java documentation for android.content.Intent.resolveActivity(android.content.pm.PackageManager).

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

See also