Freigeben über


PackageManager.ResolveActivity Method

Definition

Overloads

ResolveActivity(Intent, PackageInfoFlags)

Determine the best action to perform for a given Intent.

ResolveActivity(Intent, PackageManager+ResolveInfoFlags)

ResolveActivity(Intent, PackageInfoFlags)

Determine the best action to perform for a given Intent.

[Android.Runtime.Register("resolveActivity", "(Landroid/content/Intent;I)Landroid/content/pm/ResolveInfo;", "GetResolveActivity_Landroid_content_Intent_IHandler")]
public abstract Android.Content.PM.ResolveInfo? ResolveActivity (Android.Content.Intent intent, Android.Content.PM.PackageInfoFlags flags);
[<Android.Runtime.Register("resolveActivity", "(Landroid/content/Intent;I)Landroid/content/pm/ResolveInfo;", "GetResolveActivity_Landroid_content_Intent_IHandler")>]
abstract member ResolveActivity : Android.Content.Intent * Android.Content.PM.PackageInfoFlags -> Android.Content.PM.ResolveInfo

Parameters

intent
Intent

An intent containing all of the desired specification (action, data, type, category, and/or component).

flags
PackageInfoFlags

Additional option flags to modify the data returned. The most important is #MATCH_DEFAULT_ONLY, to limit the resolution to only those activities that support the android.content.Intent#CATEGORY_DEFAULT.

Returns

Returns a ResolveInfo object containing the final activity intent that was determined to be the best action. Returns null if no matching activity was found. If multiple matching activities are found and there is no default set, returns a ResolveInfo object containing something else, such as the activity resolver.

Attributes

Remarks

Determine the best action to perform for a given Intent. This is how Intent#resolveActivity finds an activity if a class has not been explicitly specified.

<em>Note:</em> if using an implicit Intent (without an explicit ComponentName specified), be sure to consider whether to set the #MATCH_DEFAULT_ONLY only flag. You need to do so to resolve the activity in the same way that android.content.Context#startActivity(Intent) and android.content.Intent#resolveActivity(PackageManager) Intent.resolveActivity(PackageManager) do.

Use #resolveActivity(Intent, ResolveInfoFlags) when long flags are needed.

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

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

ResolveActivity(Intent, PackageManager+ResolveInfoFlags)

[Android.Runtime.Register("resolveActivity", "(Landroid/content/Intent;Landroid/content/pm/PackageManager$ResolveInfoFlags;)Landroid/content/pm/ResolveInfo;", "GetResolveActivity_Landroid_content_Intent_Landroid_content_pm_PackageManager_ResolveInfoFlags_Handler", ApiSince=33)]
public virtual Android.Content.PM.ResolveInfo? ResolveActivity (Android.Content.Intent intent, Android.Content.PM.PackageManager.ResolveInfoFlags flags);
[<Android.Runtime.Register("resolveActivity", "(Landroid/content/Intent;Landroid/content/pm/PackageManager$ResolveInfoFlags;)Landroid/content/pm/ResolveInfo;", "GetResolveActivity_Landroid_content_Intent_Landroid_content_pm_PackageManager_ResolveInfoFlags_Handler", ApiSince=33)>]
abstract member ResolveActivity : Android.Content.Intent * Android.Content.PM.PackageManager.ResolveInfoFlags -> Android.Content.PM.ResolveInfo
override this.ResolveActivity : Android.Content.Intent * Android.Content.PM.PackageManager.ResolveInfoFlags -> Android.Content.PM.ResolveInfo

Parameters

intent
Intent

Returns

Attributes

Applies to