Build 1.0_r1(from source)

android.content.pm
Class PackageItemInfo

java.lang.Object
  extended by android.content.pm.PackageItemInfo
Direct Known Subclasses:
ApplicationInfo, ComponentInfo, InstrumentationInfo, PermissionGroupInfo, PermissionInfo

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


Nested Class Summary
static class PackageItemInfo.DisplayNameComparator
           
 
Field Summary
 int icon
          A drawable resource identifier (in the package's resources) of this component's icon.
 int labelRes
          A string resource identifier (in the package's resources) of this component's label.
 Bundle metaData
          Additional meta-data associated with this component.
 String name
          Public name of this item.
 CharSequence nonLocalizedLabel
          The string provided in the AndroidManifest file, if any.
 String packageName
          Name of the package that this item is in.
 
Constructor Summary
  PackageItemInfo()
           
  PackageItemInfo(PackageItemInfo orig)
           
protected PackageItemInfo(Parcel source)
           
 
Method Summary
protected  void dumpBack(Printer pw, String prefix)
           
protected  void dumpFront(Printer pw, String prefix)
           
 Drawable loadIcon(PackageManager pm)
          Retrieve the current graphical icon associated with this item.
 CharSequence loadLabel(PackageManager pm)
          Retrieve the current textual label associated with this item.
 XmlResourceParser loadXmlMetaData(PackageManager pm, String name)
          Load an XML resource attached to the meta-data of this item.
 void writeToParcel(Parcel dest, int parcelableFlags)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

public String name
Public name of this item. From the "android:name" attribute.


packageName

public String packageName
Name of the package that this item is in.


labelRes

public int labelRes
A string resource identifier (in the package's resources) of this component's label. From the "label" attribute or, if not set, 0.


nonLocalizedLabel

public CharSequence nonLocalizedLabel
The string provided in the AndroidManifest file, if any. You probably don't want to use this. You probably want PackageManager.getApplicationLabel(android.content.pm.ApplicationInfo)


icon

public int icon
A drawable resource identifier (in the package's resources) of this component's icon. From the "icon" attribute or, if not set, 0.


metaData

public Bundle metaData
Additional meta-data associated with this component. This field will only be filled in if you set the PackageManager.GET_META_DATA flag when requesting the info.

Constructor Detail

PackageItemInfo

public PackageItemInfo()

PackageItemInfo

public PackageItemInfo(PackageItemInfo orig)

PackageItemInfo

protected PackageItemInfo(Parcel source)
Method Detail

loadLabel

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

Parameters:
pm - A PackageManager from which the label can be loaded; usually the PackageManager from which you originally retrieved this item.
Returns:
Returns a CharSequence containing the item's label. If the item does not have a label, its name is returned.

loadIcon

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

Parameters:
pm - A PackageManager from which the icon can be loaded; usually the PackageManager from which you originally retrieved this item.
Returns:
Returns a Drawable containing the item's icon. If the item does not have an icon, the default activity icon is returned.

loadXmlMetaData

public XmlResourceParser loadXmlMetaData(PackageManager pm,
                                         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.

Parameters:
pm - A PackageManager from which the XML can be loaded; usually the PackageManager from which you originally retrieved this item.
name - Name of the meta-date you would like to load.
Returns:
Returns an XmlPullParser you can use to parse the XML file assigned as the given meta-data. If the meta-data name is not defined or the XML resource could not be found, null is returned.

dumpFront

protected void dumpFront(Printer pw,
                         String prefix)

dumpBack

protected void dumpBack(Printer pw,
                        String prefix)

writeToParcel

public void writeToParcel(Parcel dest,
                          int parcelableFlags)

Build 1.0_r1(from source)

Please submit a feedback, bug or feature