Skip to content

Most visited

Recently visited

navigation

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 ACTION_CHOOSER.

Summary

Inherited constants

From class android.content.Intent
From interface android.os.Parcelable

Fields

public static final Creator<LabeledIntent> CREATOR

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.

Inherited methods

From class android.content.Intent
From class java.lang.Object
From interface android.os.Parcelable

Fields

CREATOR

Added in API level 5
Creator<LabeledIntent> CREATOR

Public constructors

LabeledIntent

Added in API level 5
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
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
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
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
int getIconResource ()

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

Returns
int

getLabelResource

Added in API level 5
int getLabelResource ()

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

Returns
int

getNonLocalizedLabel

Added in API level 5
CharSequence getNonLocalizedLabel ()

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

Returns
CharSequence

getSourcePackage

Added in API level 5
String getSourcePackage ()

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

Returns
String

loadIcon

Added in API level 5
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
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
void readFromParcel (Parcel in)

Parameters
in Parcel

writeToParcel

Added in API level 5
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.
parcelableFlags int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.