Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set my Activity as main activity in android? [duplicate]

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

How can I define that in android manifest?

like image 600
Sathish Avatar asked Mar 14 '12 15:03

Sathish


People also ask

Can we have two launcher activities in Android?

On latest Android versions - If there are more than one launcher activities and if we don't put this category tag then the activity which is mentioned first in the Android manifest file will get launched as start-up activity.

What are the main activity in Android?

The "main" activity is the activity that loads first and the rest of your application. Every application can have multiple activities, therefore you can list other activities to load and use later on but you can only have one "main" activity.


1 Answers

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`.

like image 168
Nargis Avatar answered Sep 25 '22 17:09

Nargis