How to set my Activity as main activity in android?

Sathish picture Sathish · Mar 14, 2012 · Viewed 95.2k times · Source

I want to create own activity as main activity rather than using default MainActivity.

How can I define that in android manifest?

Answer

Nargis picture Nargis · Aug 21, 2013

In your manifest file , use the below code to declare an activity as a launcher activity:

<activity android:name=".yourActivityName" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

From Android Developer docs:

ACTION_MAIN activity: Start up as the initial activity of a task, with no data input and no returned output.

CATEGORY_LAUNCHER: The activity can be the initial activity of a task and is listed in the top-level application launcher`.