Posts

Showing posts from August, 2009

Intents

Intent objects are a bundle of information. It is used to launch the essential components of an android application, like


-startActivity(intent) for launching an activity
-startService(intent) for launching a service
-sendBroadcast(intent) for launching a Broadcast Receiver


The primary pieces of information of an Intent are


-action and
-data

Action means the action to be performed by the intent like, ACTION_DIAL, ACTION_SET_WALLPAPER etc.

Data means, the data to be operate on.


Two types of intent are
-Explicit Intent
-Implicit Intent


In explicit intents, we explictly define the target component
eg: Intent intent = new Intent();
intent.setClass(this, NextScreen.class);
startActivity(intent);
In this, we explicitly define to go to the NextScreen activity.

In implicit intents, no target component will be there. Actually, it is launching components of other application.

eg: Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER);
startActivity(intent);