Freigeben über


Intent.SetComponent(ComponentName) Method

Definition

(Usually optional) Explicitly set the component to handle the intent.

[Android.Runtime.Register("setComponent", "(Landroid/content/ComponentName;)Landroid/content/Intent;", "GetSetComponent_Landroid_content_ComponentName_Handler")]
public virtual Android.Content.Intent SetComponent (Android.Content.ComponentName? component);
[<Android.Runtime.Register("setComponent", "(Landroid/content/ComponentName;)Landroid/content/Intent;", "GetSetComponent_Landroid_content_ComponentName_Handler")>]
abstract member SetComponent : Android.Content.ComponentName -> Android.Content.Intent
override this.SetComponent : Android.Content.ComponentName -> Android.Content.Intent

Parameters

component
ComponentName

The name of the application component to handle the intent, or null to let the system find one for you.

Returns

Returns the same Intent object, for chaining multiple calls into a single statement.

Attributes

Remarks

(Usually optional) Explicitly set the component to handle the intent. If left with the default value of null, the system will determine the appropriate class to use based on the other fields (action, data, type, categories) in the Intent. If this class is defined, the specified class will always be used regardless of the other fields. You should only set this value when you know you absolutely want a specific class to be used; otherwise it is better to let the system find the appropriate class so that you will respect the installed applications and user preferences.

Java documentation for android.content.Intent.setComponent(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

See also

  • <xref:Android.Content.Intent.SetClassName(Android.Content.Context%2c+System.String)>
  • <xref:Android.Content.Intent.SetClassName(System.String%2c+System.String)>
  • Component
  • ResolveActivity(PackageManager)