Resolving an Implicit Intent

NerdLauncher will show the user a list of apps on the device. To do so, it will send an implicit intent that every application’s main activity will respond to. The intent will include a MAIN action and a LAUNCHER category. You have seen this intent filter in your projects:

  <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
  </intent-filter>

In NerdLauncherFragment.java, override onCreate(Bundle) to create an implicit intent. Then get a list of activities that match the intent from the PackageManager. For now, just log the number of activities that the PackageManager returns.

Listing 23.2  Querying the PackageManager (NerdLauncherFragment.java ...

Get Android Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.