Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the Main Activity always the first Activity to start? [duplicate]

If an app has multiple screens it means that it has multiple activities.

When a user launches the app, the first screen to appear is the Main Activity.

Does an app always start from the Main Activity?

like image 832
bart Avatar asked Dec 08 '22 11:12

bart


1 Answers

Go to your manifest file in your android studio.

You will see something like this:

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

The name of the activity that will show there is the first activity to launch, you can read more about it here

You can change this activity to another activity if you would like to, MainActivity is a default when you create a new project.


For example:

replace <activity android:name=".MainActivity">

with <activity android:name=".SecondActivity">

And now SecondActivity will show first.

like image 57
Tamir Abutbul Avatar answered Dec 11 '22 11:12

Tamir Abutbul