PackageItemInfopublic class PackageItemInfo extends Object Base class containing information common to all package items held by
the package manager. This provides a very common basic set of attributes:
a label, icon, and meta-data. This class is not intended
to be used by itself; it is simply here to share common definitions
between all items returned by the package manager. As such, it does not
itself implement Parcelable, but does provide convenience methods to assist
in the implementation of Parcelable in subclasses. |
Fields Summary |
---|
public String | namePublic name of this item. From the "android:name" attribute. | public String | packageNameName of the package that this item is in. | public int | labelResA string resource identifier (in the package's resources) of this
component's label. From the "label" attribute or, if not set, 0. | public CharSequence | nonLocalizedLabelThe string provided in the AndroidManifest file, if any. You
probably don't want to use this. You probably want
{@link PackageManager#getApplicationLabel} | public int | iconA drawable resource identifier (in the package's resources) of this
component's icon. From the "icon" attribute or, if not set, 0. | public android.os.Bundle | metaDataAdditional meta-data associated with this component. This field
will only be filled in if you set the
{@link PackageManager#GET_META_DATA} flag when requesting the info. |
Constructors Summary |
---|
public PackageItemInfo()
| public PackageItemInfo(PackageItemInfo orig)
name = orig.name;
packageName = orig.packageName;
labelRes = orig.labelRes;
nonLocalizedLabel = orig.nonLocalizedLabel;
icon = orig.icon;
metaData = orig.metaData;
| protected PackageItemInfo(android.os.Parcel source)
name = source.readString();
packageName = source.readString();
labelRes = source.readInt();
nonLocalizedLabel
= TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source);
icon = source.readInt();
metaData = source.readBundle();
|
Methods Summary |
---|
protected void | dumpBack(android.util.Printer pw, java.lang.String prefix)
// no back here
| protected void | dumpFront(android.util.Printer pw, java.lang.String prefix)
pw.println(prefix + "name=" + name);
pw.println(prefix + "packageName=" + packageName);
pw.println(prefix + "labelRes=0x" + Integer.toHexString(labelRes)
+ " nonLocalizedLabel=" + nonLocalizedLabel
+ " icon=0x" + Integer.toHexString(icon));
| public android.graphics.drawable.Drawable | loadIcon(PackageManager pm)Retrieve the current graphical icon associated with this item. This
will call back on the given PackageManager to load the icon from
the application.
if (icon != 0) {
Drawable dr = pm.getDrawable(packageName, icon, null);
if (dr != null) {
return dr;
}
}
return pm.getDefaultActivityIcon();
| public java.lang.CharSequence | loadLabel(PackageManager pm)Retrieve the current textual label associated with this item. This
will call back on the given PackageManager to load the label from
the application.
if (nonLocalizedLabel != null) {
return nonLocalizedLabel;
}
if (labelRes != 0) {
CharSequence label = pm.getText(packageName, labelRes, null);
if (label != null) {
return label;
}
}
if(name != null) {
return name;
}
return packageName;
| public android.content.res.XmlResourceParser | loadXmlMetaData(PackageManager pm, java.lang.String name)Load an XML resource attached to the meta-data of this item. This will
retrieved the name meta-data entry, and if defined call back on the
given PackageManager to load its XML file from the application.
if (metaData != null) {
int resid = metaData.getInt(name);
if (resid != 0) {
return pm.getXml(packageName, resid, null);
}
}
return null;
| public void | writeToParcel(android.os.Parcel dest, int parcelableFlags)
dest.writeString(name);
dest.writeString(packageName);
dest.writeInt(labelRes);
TextUtils.writeToParcel(nonLocalizedLabel, dest, parcelableFlags);
dest.writeInt(icon);
dest.writeBundle(metaData);
|
|