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>
Yes, you can change the name of MainActivity by, opening the directory of the java file in android studio, right-click on it and find refactor, then rename, put in the name you like then click on refactor.
Every activity that the android app uses must be declared in the AndroidManifest. xml file. and the main activity for the app must be declared in the manifest with a <intent-filter> that includes the MAIN action and LAUNCHER.
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With