0

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??

In the picture, left side is snap shot from studio and right side is from emulator.

Navdeep Soni
  • 449
  • 4
  • 15
Nisfan
  • 149
  • 3
  • 15

2 Answers2

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

enter image description here

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