Setting Application Name in Android Devices - android

I implemented a android project named 'vignesh', in which i had source package as com.example.learn.android. In my tab while uninstalling the app, its showing com.example.learn instead of project name alone. Please advice..

You can specify your application label in the AndroidManifest.xml
<application
android:label="#string/app_name"
...>
</application>
In the above example you have to define app_name in res/strings.xml
<string name="app_name">My app name</string>

If this is not working in the AndroidManifest.xml file:
<application
android:label="#string/app_name"
...>
</application>
Look for the startup activity(the activity with the android.intent.action.MAIN & android.intent.category.LAUNCHER), example:
<activity
android:name=".SplashScreen"
android:label="com.example.learn"
android:noHistory="true"
android:screenOrientation="landscape"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
You probably have the android:label mentioned just like the example above. The strange thing is that Android takes your first activity's name (label) as app name (I don't know why).
If you just remove (or rename) the android:label="com.example.learn" line it should be ok. Removing the line ensures that the app will look for the android:label tag defined in the <application> part of the AndroidManifest.xml file.

Related

ActivityNotFoundException: Shortcut could not be started

I'm trying to implement App Shortcuts to my app, but i can't get them work.
My shortcut.xml:
<Shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:shortcutId="shortcut"
android:enabled="true"
android:icon="#drawable/ic_shortcut"
android:shortcutShortLabel="#string/shortcut_label">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="com.example"
android:targetClass="com.example.package.Activity"/>
</shortcut>
manifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example">
<application
android:name=".Application"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:resizeableActivity="false"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".package.Activity"
android:label="#string/app_name"
android:launchMode="singleTask"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="#xml/voice_search_params" />
<meta-data android:name="android.app.shortcuts"
android:resource="#xml/shortcuts" />
</activity>
So, i do shortcut same as in google example. I can see and click on shortcut, but nothing happens. I've tried different activities, changing activity location, activity action, params, like "exported=true", but nothing changes - in logs i can see only
ActivityNotFoundException: Shortcut could not be started
The only difference between my shortcut log, and google camera shortcut log is path to activity:
I/ActivityManager: START u0 {act=android.intent.action.VIEW flg=0x1000c000 cmp=com.example/.package.Activity}
vs
I/ActivityManager: START u0 {act=android.media.action.STILL_IMAGE_CAMERA flg=0x1000c000 cmp=com.google.android.GoogleCamera/com.android.camera.activity.CameraImageActivity}
Google cam has full path to activity, but package path differs.
PS: tried today google sample, static app shortcuts doesn't work in sample too. Dynamic app shortcuts work well.
In addition to Matin's answer, if you have multiple build types that change your application id, it won't work.
In my case, I had .debug and .qa suffix for application id. You can't reference to string reference or use variables inside intent element.
I found two solutions:
1) You will create different shortcuts.xml file for different build types and update your targetPackage.
For example,
<intent
android:action="com.example.ACTION"
android:targetClass="com.example.MainActivity"
android:targetPackage="com.example.debug"/>
2) There is a plugin that allows you to use applicationId variable in your XML file.
https://github.com/timfreiheit/ResourcePlaceholdersPlugin
android:targetPackage have to contain your application ID. So if you have defined your app id in build.gradle as applicationId "com.my.app.id" you have to use android:targetPackage="com.my.app.id"
Change the package name on your Activity to:
android:name=".Activity"
Change your shortcut target class to:
android:targetClass="com.example.Activity"
I also met this problem. Then i found that android:targetClass is not right path.
android:targetClass="com.example.camille.testappshortcuts.Main"
Main is app's access.
Maybe you should change Activity to another name, then add it.

How to insert an android activity into the manifest given in a tutorial?

I am very new to android development with eclipse, and I encounter dozen of errors and problems. Here is the next one:
I am following an android tutorial given here in order to set up the action bar. In this tutorial is says to insert an activity as follows:
<activity android:theme="#style/Theme.AppCompat.Light" ... >
Can I just put this line into the xml manifest file?
<activity android:theme="#style/Theme.AppCompat.Light">
Or do I need to replace the '...' by something more useful?
Please read the docs: activity-element
The activity's name is required, so you would need to have:
<activity android:theme="#style/Theme.AppCompat.Light" android:name="MyActivity">
Other than that, you are not required to add any other attributes.
Although be sure to place the activity element within the proper place in your xml. It should be contained in your application block:
<application android:label="#string/app_name"
android:icon="#drawable/ic_launcher"
android:theme="#android:style/Theme.Holo.Light">
<activity android:name="MyActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
Unless you really want your app to work under API levels under 3.0 then you have to add it like this.
android:theme="#style/Theme.AppCompat.Light"
Inside your already defined activity in your manifest (the one that has the intent filter and other declarations).
otherwise you dont have to add that at all.
This is one example.
<activity
android:name=".MainActivity"
android:theme="#style/Theme.AppCompat.Light"
android:screenOrientation="portrait"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
and this is another
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme=#style/Theme.AppCompat.Light"" >
<activity android:name=".DetailActivity"
android:label="#string/app_name" >
</activity>
The second way you posted is just fine, be sure to close the activity tag so it looks like <activity android:theme="#style/Theme.AppCompat.Light"></activity>
Also, if you're using eclipse, it is easier to go into the AndroidManifest and under the Application tab scroll to the bottom where there's Application Nodes and then add your view from there. Eclipse will auto generate the correct code in the xml file.

Change text displayed below app icon on android/eclipse

I would like to change the text that is displayed below the icon when you can look at all the apps on your phone, i.e. the "Facebook" below the facebook logo icon. How would I go about doing this? I have tried strings.xml but that did not have what I was looking for. Any help would be greatly appreciated.
You can do it programmatically in your activity:
setTitle("Activity title");
or
getActionBar().setTitle("Activity title");
Or in your AndroidManifest file, there is android:label tag:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:theme="#style/AppTheme">
<activity
android:name="com.example.so1.MainActivity"
android:label="ACTIVITY NAME"
>
</activity>
</application>
Also if you want to change Launcher activity's title to something different than your app name then you could do it like this:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:theme="#style/AppTheme">
<activity
android:name="com.example.so1.MainActivity"
android:label="ACTIVITY NAME"
>
<intent-filter android:label="APP NAME">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
How would I go about doing this?
This is controlled by the android:label attribute on the <activity> element in the manifest for your LAUNCHER activity. If your <activity> does not have an android:label attribute, it will inherit the value from the <application> element.
If you want to do it for your app that you are building,, then you need to change it inAndroidManifest.xml under android:label
<application
android:label="#string/app_name"
In your string.xml you can have an entry with app_name.
<string name="app_name">The Name</string>
Hope it helps.

App taking splash as the app name

Can anyone tell me how to change the app name? My app is taking splash as the app name on the Emulator since my first activity is splash.
EDIT:
It takes "splash" as the app name before the app is launched. Once it is launched the right name is displayed.
Manifest:
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.sanginfo.temperatureconvertor.SplashActivity"
android:label="#string/title_activity_splash" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.sanginfo.temperatureconvertor.LoginActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.LoginActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
In your manifest file under application tag change this tag with whatever you want as a app name..android:label="#string/app_name"
use the name attribute on application node as describe in :
http://developer.android.com/guide/topics/manifest/application-element.html
#stylojack_10
Go to the File name String.xml (Project->res->values->string.xml)
change the value of the tag name app_name.
you can even make your own tag there and make change in Android Manifest file under tag find android:label="#string/"your custom app name""
Hope this will resolve your problem
Solution 1: (this solution works most of the time)
Go to res -> values -> strings.xml -> appname, change name of the app there.
No go to Android Manifest and check if it looks like this:
<application
android:label="#string/app_name"
.......................
>
If android:label="#string/app_name" is changed to android:label="MyApp", than change it to one shown above. Your problem should be solved.
Solution 2:
there was a file called OldAppName.launch
it is located in workspace/.metadata/.plugins/org.eclipse.debug.core/.launches
also stuff on:
/User/workspace/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings
also a glitch in Eclipse to show old app name instead of changing the name.

How to change an Android app's name?

Is there a way to change the name (Launcher App Label) of an app without creating a new project?
Note: Name of the App and The label shown on the Launcher Icon on Home Screen on Mobiles can be different.
Example: On the home page in my Mobile where my apps are, I have an icon and the name Foo, but I want to change the name to Bar. Can I do this?
Yes you can. By changing the android:label field in your application node in AndroidManifest.xml.
Note: If you have added a Splash Screen and added
<activity
android:name=".SplashActivity"
android:label="#string/title_activity_splash_screen"
android:theme="#style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
to your Splash Screen, then the Launcher Icon name will be changed to the name of your Splash Screen Class name.
Please make sure that you change label:
android:label="#string/title_activity_splash_screen"
in your Splash Screen activity in your strings.xml file. It can be found in Res -> Values -> strings.xml
See more here.
There's the android:label for the application, and the android:label for the launch activity. The former is what you see under Settings -> Applications -> Manage Applications on your device. The latter is what you see under Applications, and by extension in any shortcut to your application, e.g.
<application
android:label="#string/turns_up_in_manage_apps" >
<activity
android:name=".MainActivity"
android:label="#string/turns_up_in_shortcuts" >
...
</activity>
</application>
This is a simple thing in Android Studio,
go to: res folder -> values -> strings.xml
change the app_name (in the bellow example:MitsuhoSdn Bhd) to any new name you want.
<string name="app_name">MitsuhoSdn Bhd</string>
<string name="hello_world">Hello world!</string>
<string name="menu_settings">Settings</string>
I noticed there are some differences in how the app name can turn up in Lollipop devices. Before Lollipop, you can have different app names with this:
<application
android:label="#string/app_name"> // appears in manage app info
<activity
android:name=".MainActivity"
android:label="#string/action_bar_title"> // appears in actionbar title
<intent-filter android:label="#string/name_in_icon_launcher"> // appears in icon launcher
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
...
In Lollipop, it will be like this:
<application
android:label="#string/name_in_manage_app_info">
<activity
android:name=".MainActivity"
android:label="#string/name_in_actionbar_and_icon_launcher">
<intent-filter android:label="#string/this_is_useless">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
In Lollipop, android:label in intent-filter is basically useless, while actionbar title and icon launcher is identical. So, if you want a different title in actionbar, you have no choice but to set dynamically
getSupportActionBar().setTitle(R.string.app_name);
You might have to change the name of your main activity "android:label" also, as explained in Naming my application in android
It depends what you want to do. I personally wanted to rename my project so it didn't say MainActivity at the top of the app and underneath the icon on my phone menu.
To do this I went into the Android Manifest.xml file and edited
<activity
android:name=".MainActitivity"
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>
And edited the android:name=".Mynewname" and then edited the string title_activity_main in the strings.xml file to match the name.
Hope that helps!
if you want to change app name under launcher icon then change this android:label="#string/app_name"
inside your Main Launcher activity tag
<activity android:name="com.test.app"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
And if you want to change app name inside
Settings -> Application manager -> downloaded
where you have all installed applications then change this android:label="#string/app_name"
inside application tag
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
........
<activity android:name="com.test.app" >
</activity>
.......
</application>
To change the name of your Android application in Android Studio or Eclipse, you have to change the value of the property android:label defined inside the <application> node in AndroidManifest.xml
android:label="My Cool Application!"
by default the name of the application is referenced to a string defined in strings.xml file, for example:
android:label="#string/app_name"
so, we have to change the value inside the strings.xml file:
<string name="app_name">My Cool Application!</string>
<application
android:icon="#drawable/app_icon"
android:label="#string/app_name">
<activity
android:name="com.cipl.worldviewfinal.SplashActivity"
android:label="#string/title_activity_splash" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
To change android app's name , go to activity which is launcher activity and change its label like I have done above in my code.
If you're using android studio an item is under your strings.xml
<string name="app_name">BareBoneProject</string>
It's better to change the name here because you might have used this string somewhere.Or maybe a library or something has used it.That's it.Just build and run and you'll get new name.Remember this won't change the package name or anything else.
Nevermind I found it. It can be done in the manifest file under application just set the android label. Was thrown off at first becasue it didn't change my shortcut of the application's name.
Go to Strings.xml file under values.
Change the app_name tag to your app_name to want and it is all set, you will be able to see the name you change now.
follow the steps:(let I assuming you have chosen Android view)
app>res>values>strings
<string name="app_name">Put your App's new name here</string>
Edit the application tag in manifest file.
<application
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen" >
Change the label attribute and give the latest name over there.
The change in Manifest file did not change the App name,
<application android:icon="#drawable/ic__logo" android:theme="#style/AppTheme" android:largeHeap="true" android:label="#string/app_name">
but changing the Label attribute in the MainLauncher did the trick for me .
[Activity(Label = "#string/app_name", MainLauncher = true, Theme = "#style/MainActivityNoActionBarTheme", ScreenOrientation = ScreenOrientation.Portrait)]
Old question but also now relative to Xamarin Android development:
As Xamarin allows for attributes to be used for adding items into the manifest, you may need to open your MainActivity.cs file and change the Label tag to your application's name:
Note: This attribute will override written android:label= tags in your manifest file as I found out whilst archiving the app ready for release so be sure to change this attribute too.
Yes Of-course........Android Supports to change the name of the App before making build just like iOS (Build Configuration).
You can change it by Modifying the Android manifest file for the project.
If you are here because when you tried to upload your fresh/brand new application using the play console it displayed this error:
"You must use another package name because "some.package.name" already exists in Google Play."
You just need to go to your build.gradle file (your application) and change
applicationId "some.package.name"
to
applicationId "some.package.different-unique-name"
Other answers here didn't fix this error.
in my case i need invalidate/cache and restart and its work
change the app string resource to your new activity

Categories

Resources