Android APIs
public class

LabeledIntent

extends Intent
java.lang.Object
   ↳ android.content.Intent
     ↳ android.content.pm.LabeledIntent

Class Overview

A special subclass of Intent that can have a custom label/icon associated with it. Primarily for use with ACTION_CHOOSER.

Summary

[Expand]
Inherited Constants
From class android.content.Intent
From interface android.os.Parcelable
Fields
public static final Creator<LabeledIntent> CREATOR
[Expand]
Inherited Fields
From class android.content.Intent
Public Constructors
LabeledIntent(Intent origIntent, String sourcePackage, int labelRes, int icon)
Create a labeled intent from the given intent, supplying the label and icon resources for it.
LabeledIntent(Intent origIntent, String sourcePackage, CharSequence nonLocalizedLabel, int icon)
Create a labeled intent from the given intent, supplying a textual label and icon resource for it.
LabeledIntent(String sourcePackage, int labelRes, int icon)
Create a labeled intent with no intent data but supplying the label and icon resources for it.
LabeledIntent(String sourcePackage, CharSequence nonLocalizedLabel, int icon)
Create a labeled intent with no intent data but supplying a textual label and icon resource for it.
Public Methods
int getIconResource()
Return any resource identifier that has been given for the label icon.
int getLabelResource()
Return any resource identifier that has been given for the label text.
CharSequence getNonLocalizedLabel()
Return any concrete text that has been given for the label text.
String getSourcePackage()
Return the name of the package holding label and icon resources.
Drawable loadIcon(PackageManager pm)
Retrieve the icon associated with this object.
CharSequence loadLabel(PackageManager pm)
Retrieve the label associated with this object.
void readFromParcel(Parcel in)
void writeToParcel(Parcel dest, int parcelableFlags)
Flatten this object in to a Parcel.
[Expand]
Inherited Methods
From class android.content.Intent
From class java.lang.Object
From interface android.os.Parcelable

Fields

public static final Creator<LabeledIntent> CREATOR

Added in API level 5

Public Constructors

public LabeledIntent (Intent origIntent, String sourcePackage, int labelRes, int icon)

Added in API level 5

Create a labeled intent from the given intent, supplying the label and icon resources for it.

Parameters
origIntent Intent: The original Intent to copy.
sourcePackage String: The package in which the label and icon live.
labelRes int: Resource containing the label, or 0 if none.
icon int: Resource containing the icon, or 0 if none.

public LabeledIntent (Intent origIntent, String sourcePackage, CharSequence nonLocalizedLabel, int icon)

Added in API level 5

Create a labeled intent from the given intent, supplying a textual label and icon resource for it.

Parameters
origIntent Intent: The original Intent to copy.
sourcePackage String: The package in which the label and icon live.
nonLocalizedLabel CharSequence: Concrete text to use for the label.
icon int: Resource containing the icon, or 0 if none.

public LabeledIntent (String sourcePackage, int labelRes, int icon)

Added in API level 5

Create a labeled intent with no intent data but supplying the label and icon resources for it.

Parameters
sourcePackage String: The package in which the label and icon live.
labelRes int: Resource containing the label, or 0 if none.
icon int: Resource containing the icon, or 0 if none.

public LabeledIntent (String sourcePackage, CharSequence nonLocalizedLabel, int icon)

Added in API level 5

Create a labeled intent with no intent data but supplying a textual label and icon resource for it.

Parameters
sourcePackage String: The package in which the label and icon live.
nonLocalizedLabel CharSequence: Concrete text to use for the label.
icon int: Resource containing the icon, or 0 if none.

Public Methods

public int getIconResource ()

Added in API level 5

Return any resource identifier that has been given for the label icon.

Returns
int

public int getLabelResource ()

Added in API level 5

Return any resource identifier that has been given for the label text.

Returns
int

public CharSequence getNonLocalizedLabel ()

Added in API level 5

Return any concrete text that has been given for the label text.

Returns
CharSequence

public String getSourcePackage ()

Added in API level 5

Return the name of the package holding label and icon resources.

Returns
String

public Drawable loadIcon (PackageManager pm)

Added in API level 5

Retrieve the icon associated with this object. If the object does not have a icon, null will be returned, in which case you will probably want to load the icon from the underlying resolved info for the Intent.

Parameters
pm PackageManager
Returns
Drawable

public CharSequence loadLabel (PackageManager pm)

Added in API level 5

Retrieve the label associated with this object. If the object does not have a label, null will be returned, in which case you will probably want to load the label from the underlying resolved info for the Intent.

Parameters
pm PackageManager
Returns
CharSequence

public void readFromParcel (Parcel in)

Added in API level 5

Parameters
in Parcel

public void writeToParcel (Parcel dest, int parcelableFlags)

Added in API level 5

Flatten this object in to a Parcel.

Parameters
dest Parcel: The Parcel in which the object should be written.
parcelableFlags int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.