Activity interaction with Intents
An intent in Android is a communication mechanism between components. Within your own app, a lot of the time, you will want another specific Activity to start when some action happens in the current activity. Specifying exactly which Activity will start is called an explicit intent. On other occasions, you will want to get access to a system component, such as the camera. As you can’t access these components directly, you will have to send an intent, which the system resolves in order to open the camera. These are called implicit intents. An intent filter has to be set up in order to register to respond to these events. Go to the AndroidManifest.xml
file from the previous exercise and you will see an example of two intent filters set within the <intent-filter>
XML element of the MainActivity
:
<intent-filter> <action android:name="android.intent.action.MAIN"/> <...