Udostępnij za pośrednictwem


PackageManager.AddPreferredActivity Method

Definition

Caution

deprecated

Add a new preferred activity mapping to the system.

[Android.Runtime.Register("addPreferredActivity", "(Landroid/content/IntentFilter;I[Landroid/content/ComponentName;Landroid/content/ComponentName;)V", "GetAddPreferredActivity_Landroid_content_IntentFilter_IarrayLandroid_content_ComponentName_Landroid_content_ComponentName_Handler")]
[System.Obsolete("deprecated")]
public abstract void AddPreferredActivity (Android.Content.IntentFilter filter, Android.Content.MatchResults match, Android.Content.ComponentName[]? set, Android.Content.ComponentName activity);
[<Android.Runtime.Register("addPreferredActivity", "(Landroid/content/IntentFilter;I[Landroid/content/ComponentName;Landroid/content/ComponentName;)V", "GetAddPreferredActivity_Landroid_content_IntentFilter_IarrayLandroid_content_ComponentName_Landroid_content_ComponentName_Handler")>]
[<System.Obsolete("deprecated")>]
abstract member AddPreferredActivity : Android.Content.IntentFilter * Android.Content.MatchResults * Android.Content.ComponentName[] * Android.Content.ComponentName -> unit

Parameters

filter
IntentFilter

The set of intents under which this activity will be made preferred.

match
MatchResults

The IntentFilter match category that this preference applies to.

set
ComponentName[]

The set of activities that the user was picking from when this preference was made.

activity
ComponentName

The component name of the activity that is to be preferred.

Attributes

Remarks

Add a new preferred activity mapping to the system. This will be used to automatically select the given activity component when Context#startActivity(Intent) Context.startActivity() finds multiple matching activities and also matches the given filter.

This member is deprecated. This function no longer does anything. It is the platform's responsibility to assign preferred activities and this cannot be modified directly. To determine the activities resolved by the platform, use #resolveActivity or #queryIntentActivities. To configure an app to be responsible for a particular role and to check current role holders, see android.app.role.RoleManager.

Java documentation for android.content.pm.PackageManager.addPreferredActivity(android.content.IntentFilter, int, android.content.ComponentName[], android.content.ComponentName).

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