android project name and app name are different

1.1k Views Asked by At

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.

2

There are 2 best solutions below

3
On BEST ANSWER

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>
0
On

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);


}