Charlie Calvert on Elvenware

Writing Code and Prose on Computers



Android supports a number of components such as Activities, Content Providers and Broadcast Receivers. If you want to start a component, you can use an Intent. Android is designed in such a way that you can use Intents to start a component that belongs to another application.

When you create a component, you can register it in the manifest. The files that you register in a manifest can be started or invoked by an intent. Consider this Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
  <application android:name=".MyApplication"
    android:label="Test Provider">
    <activity android:name=".HelloWorld"
      android:label="Test Provider">
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    <activity android:name="DisplayDataActivity"></activity> 
    <activity android:name="InsertDataActivity"></activity>
    <provider android:name=".BookProvider"
<uses-sdk android:minSdkVersion="3" />

In the code shown above, there are at least four components:

  1. Activity HelloWorld
  2. Activity DisplayDataActivity
  3. Acticvty InsertDataActivity
  4. Content Provider BookProvider

Note that the Activity called HelloWorld is marked as belonging to the category LAUNCHER. This means that Android will place it in them in the list of applications that you can reach from the home screen of the Android OS. It puts the application name and its icon on that screen so that you can see the available applications.

Creating an Intent.

Creating an Activity with an intent is covered in the Activity page. For review, you can look at this code:

public void onShowIntent(View view)
  TextView textShowIntent = (TextView)this.findViewById(;

public void onSwitchToScreenTwo(View view)
  Intent intent = new Intent(view.getContext(), ScreenTwo.class);

Note the method called onShowIntent. This method calls getIntent() and then displays a string that provides a minimal description of Here is what it looks like when the onShowIntent method is called immediately after program launch:

Small Intents

Figure 01: You can see how the intent for the main screen describes itself after the program is launched.

Intent with text small

Figure 02: Here are the intents for the second screen. Compare to contents of Manifest.