Types of Intents and Activities in Android
However, just one more detail to be introduced as promised and that is -
There are 2 types of intents that Android understands.
1. Explicit Intent
2. Implicit Intent
In an Explicit intent, you actually specify the activity that is required to respond to the intent. In other words, you explicitly designate the target component. This is typically used for application internal messages.
In an Implicit intent (the main power of the android design), you just declare an intent and leave it to the platform to find an activity that can respond to the intent. Here, you do not declare the target component and hence is typically used for activating components of other applications seamlessly
There are 2 types activities
a. InvokingActivity
b. InvokedActivity
The InvokingActivity has a button "Invoke Next Activity" which when clicked explicitly calls the "InvokedActivity" class.
The relevant part of the code is here:
Button invokingButton = (Button)findViewById(R.id.invokebutton);
invokingButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent explicitIntent = new Intent(InvokingActivity.this,InvokedActivity.class);
startActivity(explicitIntent);
}
});
NOTE: The layout for InvokingActivity is defined main.xml and for InvokedActivity in InvokedActivity.xml. The downloadable example can be opened in Eclipse Ganymede as an android project and can be executed.