Home » Android » New Android Project named after Main Activity instead of app name

New Android Project named after Main Activity instead of app name

Posted by: admin June 15, 2020 Leave a comment

Questions:

I am creating new android projects in Eclipse Juno with the latest ADT plugin and im running into a problem with the name of the app. Whenever I run the app, it runs fine, but when I go to the app list, the name of the app isnt there. Instead I have a new app named MainActivity which is the name of the first activity in the app. The app_name string is set to the name of the app, but it still doesnt work. I figured out changing the title_activity_main to the name of the application fixed the problem with the wrong app name in the app drawer, but that seems like a backwoods kind of way to fix that. Anyone else experience that problem, or just hating the new ADT like me?

Manifest Code

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bv.testapp"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="4"
    android:targetSdkVersion="15" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name">
    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

How to&Answers:

I am also using the updated adt and having the same problem and finally comes out with the only solution which is as follows

<application
    android:name="GlobalData"
    android:icon="@drawable/hdpi"
    android:label="@string/app_name"
    android:theme="@style/AppTheme">

    <activity android:theme="@android:style/Theme.NoTitleBar"
        android:name=".ApplicationCommence"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>

Here above the in "@string/app_name" having my project name.

Answer:

I found the solution for you.. In the manifest file, you are able to set one label for the launcher icon, and another for the activity. The app name is set in the intent filter, like this:

<activity
    android:name=".Start"
    android:label="@string/activity_start" >
    <intent-filter android:label="@string/app_name" >
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

Cheers

//Nautious

Answer:

Recently i have this problem: can you please try with this:

<activity
    android:name=".MainActivity"
    android:label="@string/app_name" >

or remove android:label from activity

Answer:

I was also irritated by this problem, finally found a work around and now I am sure it’s a bug in new ADT. I added android:name=”name_of_my_app” and changed the android:label=”name_of_the_app” and it worked as expected.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.nitin.sunflow"
    android:versionCode="1"
    android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="15" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    android:name = "Sunflow"
    <activity
        android:name=".MainActivity"
        android:label="Sunflow" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

Answer:

I did noticed lots of demo apps come with the name MainActivity, and making importing other projects annoying… but shouldn’t “right click project ==> rename” fix the name conflicts?

Answer:

For overcoming this problem, make a habit of giving app name at “Title” which is marked. This will obviously solve your problem.

Answer:

Steps for creating new android project from the new ADT:

  1. You enter your application name/package and target SDK version.
  2. On the next view, you choose your app icon.
  3. On the third view, you come across to choose between two activities – blankactivity and masterdetail flow.
  4. On the 4th view, you enter your activity-name, layout-name, and at last field you will notice one field is “Title”, in that field enter your App Name, and when you will install the app on the device/emulator you will see your app name through there.

Was that clear?