2.3: Start Activities with Implicit Intents

Build and run an app

When the button is clicked, launch a camera app to take a picture. (You don't need to return the picture to the original app.)

Note: If you use the Android emulator to test the camera, open the emulator configuration in the Android AVD manager, choose Advanced Settings, and then choose "Emulated" for both front and back cameras. Restart your emulator if necessary.

Answer these questions

Question 1

Which constructor method do you use to create an implicit intent to launch a camera app?

new Intent()

new Intent(Context context, Class<?> class)

new Intent(String action, Uri uri)

new Intent(String action)

Question 2

Which intent action do you use to request a camera app?

Submit your app for grading

Guidance for graders

Check that the app has the following features:

It displays a "Take a Picture" button at the bottom of the app.

When clicked, the button launches a camera app on the device.

The on click method for the Take a Picture button ensures there is an available app on the device (with the resolveActivity() and getPackageManager() methods) before sending the intent.