LabeledIntent


public class LabeledIntent
extends Intent

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


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

Summary

Inherited constants

Fields

public static final Creator<LabeledIntent> CREATOR

Inherited fields

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.

Inherited methods

Fields

CREATOR

Added in API level 5
public static final Creator<LabeledIntent> CREATOR

Public constructors

LabeledIntent

Added in API level 5
public 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.

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.

LabeledIntent

Added in API level 5
public 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.

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.

LabeledIntent

Added in API level 5
public LabeledIntent (String sourcePackage, 
                int labelRes, 
                int icon)

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.

LabeledIntent

Added in API level 5
public 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.

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

getIconResource

Added in API level 5
public int getIconResource ()

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

Returns
int

getLabelResource

Added in API level 5
public int getLabelResource ()

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

Returns
int

getNonLocalizedLabel

Added in API level 5
public CharSequence getNonLocalizedLabel ()

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

Returns
CharSequence

getSourcePackage

Added in API level 5
public String getSourcePackage ()

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

Returns
String

loadIcon

Added in API level 5
public Drawable loadIcon (PackageManager pm)

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

loadLabel

Added in API level 5
public CharSequence loadLabel (PackageManager pm)

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

readFromParcel

Added in API level 5
public void readFromParcel (Parcel in)

Parameters
in Parcel

writeToParcel

Added in API level 5
public void writeToParcel (Parcel dest, 
                int parcelableFlags)

Flatten this object in to a Parcel.

Parameters
dest Parcel: The Parcel in which the object should be written. This value cannot be null.

parcelableFlags int: Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES