Who wants to start an app to start other apps? It would make more sense to offer NerdLauncher as a replacement for the device’s Home screen. Open NerdLauncher’s AndroidManifest.xml and add to its main intent filter.
Listing 24.10 Changing NerdLauncherActivity
’s categories (AndroidManifest.xml
)
<intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.HOME" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter>
By adding the HOME
and DEFAULT
categories, NerdLauncherActivity is asking to be offered as an option for the Home screen.
Press the Home button, and NerdLauncher will be offered as an option (Figure 24.12).
(If you make NerdLauncher the Home screen, you can easily change it back later. Launch the Settings app from NerdLauncher. If you are running Lollipop or later, go to Settings → Apps. Select NerdLauncher from the app list. If you are running a pre-Lollipop version of Android, go to Settings → Applications → Manage Applications. Select All to find NerdLauncher. Once you have selected NerdLauncher, you should be on the App Info screen. Scroll down to Launch by default and press the CLEAR DEFAULTS button. The next time you press the Home button, you will be able to select another default.)