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

Constants
Creator<LabeledIntent> CREATOR
[Expand]
Inherited Constants
From class android.content.Intent
From interface android.os.Parcelable
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

Constants

public static final Creator<LabeledIntent> CREATOR

Since: API Level 5

Public Constructors

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

Since: API Level 5

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

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

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

Since: API Level 5

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

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

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

Since: API Level 5

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

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

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

Since: API Level 5

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

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

Public Methods

public int getIconResource ()

Since: API Level 5

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

public int getLabelResource ()

Since: API Level 5

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

public CharSequence getNonLocalizedLabel ()

Since: API Level 5

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

public String getSourcePackage ()

Since: API Level 5

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

public Drawable loadIcon (PackageManager pm)

Since: 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.

public CharSequence loadLabel (PackageManager pm)

Since: 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.

public void readFromParcel (Parcel in)

Since: API Level 5

public void writeToParcel (Parcel dest, int parcelableFlags)

Since: API Level 5

Flatten this object in to a Parcel.

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