I am doing an android project using Android Studio. My project name is "Policia". I run the project on emulator and it shows another name "LoginActivity". Actually its the launcher activity. How can I solve this??
Asked
Active
Viewed 1,144 times
0
-
post code of your xml. – Shabbir Dhangot Mar 28 '15 at 05:54
-
So, I have to set the app_name as the title of main activity. Thanks for the help. – Nisfan Mar 28 '15 at 07:10
2 Answers
0
In your main activity listed in manifest file see the android:label
value
android:label="@string/app_name"
Then see string.xml
file in resource (res
) folder to see the actual String value of app_name
. Change it to whatever you desire.
Main activity will be the one with following intent-filter
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

Aniket Thakur
- 66,731
- 38
- 279
- 289
-
-
In that case you should see `Policia` in the Action bar. What text does it show there? – Aniket Thakur Mar 28 '15 at 06:20
-
sorry. i set the label of main activity to the activity_name, just like other activities. – Nisfan Mar 28 '15 at 07:09
0
This is happening because you tried to change the label of your launcher activity (activity that is started when the user starts your app) from the string/app_name
attribute in the manifest file to something else.
To change the label(title) of your activity without any strange behaviour, go to your activity and add the label there. In the onCreate()
method, do this:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(R.string.your_app_title); //<--change title to whatever you want
setContentView(R.layout.activity_main);
}

Ojonugwa Jude Ochalifu
- 26,627
- 26
- 120
- 132