For the More Curious: Running Activities from the Command Line

In this chapter, you were able to test your camera code fairly quickly by adding a button to CrimeFragment and starting CrimeCameraActivity. Sometimes, however, you will want to test code in a new activity before you have hooked it up to the rest of your app.

One quick-and-dirty way to do this is to switch the launcher intent filter in the manifest from the declaration of the app’s intended launcher activity to the activity you want to test. Then, when the app is launched, your activity will appear. On the downside, you may be unable to reach other parts of your app until order has been restored in the manifest.

This launcher intent switcheroo is not always appropriate – like, for ...

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.