How to Declare a PackageManager object

PackageManager was added in API Level 1
Class for retrieving various kinds of information related to the application packages that are currently installed on the device.

1. In the file, add the below import to the imports section.


2. In the onCreate method, add the below line. This will declare a PackageManager named myPackageManager.

PackageManager myPackageManager;

3. Compile and run!

4. Next, Get a PackageManager Instance

Professional Android 4 Application Development by Reto Meier, pg 702