I dream a dream.

What is android intent?

Android folds multiple ideas into the concept of an intent. You can use intents to invoke other applications from your application. You can use intents to invoke internal or external components from your application. You can use intents to raise events so that others can respond in a manner similar to a publish-and-subscribe model. You can use intents to represent actions.
At the simplest level, an intent is an action that you can tell Android to invoke. The action Android invokes depends on what is registered for that action. (Pro Android – Apress)

Register an activity as android intent?

In this section, I want to describe a way to register an activity as an android intent.

If you don’t know how to add an activity, please read my post here. Suppose that you created an activity name MyActivity. Now, open AndroidManifest.xml file, choose the tab AndroidManifest.xml to edit it manually.  Add action and category element inside your activity element as below image.

<activity android:name=”MyActivity”>
                <action android:name=”sandbox.basic.activity.intent.action.show_my_activity”></action>
                <category android:name=”android.intent.category.DEFAULT”></category>

The general convention for an action name is <your-package-name>.intent.action.YOUR ACTION NAME

From now, whenever you need to use your intent, you can invoked it such as below:

String actionName = “sandbox.basic.activity.intent.action.ShowMyActivity”;
Intent newIntent = new Intent(actionName);




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: