How to rename an Android app programmatically? - android

Some users want to rename my Android app to something else.
So I'd like to provide a text field for them to put in a new name inside my app.
Then how can I programmatically rename my app name to the new name?

You want to rename your app or change the title when application is running?
To change the title you have setTtle() funcion from activity.
If you want to change application name in string.xml you should have a value called app_name.
You have to rename it to the new value.
To do so you have to unzip the apk and modify the xml file and then repack it.
But making this way I think application have to be reinstalled.

Related

How to change display name of an app in react-native

Apple have clear instructions on how to change the display name of an IOS app, but they are not useful for a react-native app because the folder structure is different. How do you change the display name if you have a react-native app?
iOS
Goto ios/<Appname>/Info.plist and edit the $(PRODUCT_NAME) to change the display name
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
Android
Goto android/app/src/main/res/values/strings.xml and edit the APP_NAME to change the name
<string name="app_name">APP_NAME</string>
for ios just add this to Info.plist
<key>CFBundleDisplayName</key>
<string>APP_NAME</string>
for android edit strings.xml file which located in res/values/
<string name="app_name">APP_NAME</string>
res -> values -> strings.xml
<string name="app_name">YOUR APP NAME HERE</string>
Change that and you will have changed your display name of the app.
Inside the manifest file, inside the application tag you will find
android:label="#string/app_name"
You can change this too, if you want to change the display name of your app.
Note: It is always recommended to have values stored in the "values" folder instead of hardcoding the values directly.
There's a file called app.json in the root of your project. Just change the "displayName" then delete ios folder and run "react-native eject".
file path : /android/app/src/main/res/values/strings.xml
replace My App with your app name.
Instead of creating an app from a template with a Display Name which needs to be changed later, it would be preferable to create the app with the desired names from the start, as I explain here in my answer. For a new app use:
npx react-native init NewcoFrameDesign --title "Newco Frame Design"
The --title option corresponds to the display name in android/app/src/main/res/values/strings.xml and ios/NewcoFrameDesign/Info.plist as well as in app.json.

Calabash-Android: Set system time to text field

I am testing a android app and want to add name to ListView. But I want it to auto generate name which make it unique in the list.
I tried and can add system date to CustomTextView with code below in console.
query("ClearableEditText id:'edt_event_name'", :setText=>`adb shell date`)
Then I want to paste these to .feature and .sh file but no idea to make it work.
Any idea please help!
Thank you

Set android application's name

I am trying to set the name of my application and the name of my first activity to different values (I need trademark sign in my activity label, but not in the app name). I found this Naming my application in android and in the last comment the said if I set the app name using #string it will have affect, but it doesn't have. Is ther any way to do this?
On your onCreate()
String title = getTitle().toString();
setTitle(title + "(R)");
Being (R) the copyright symbol :)
AFAIK there is no way to achieve this in the manifest since the name attribute is used in the launcher automatically (I suggest that's what you mean with 'application name'). But you can do this in your code by simply using:
setTitle(R.string.yourActivityTitle)
-> The string in your manifest is used as "application name" and the string in your code is used for activity name.
Hope that helps...

Can localization resources be downloaded in runtime?

I have application with internet access and don't want to store many string.xml files for different languages.
What I want:
Application contains only one string.xml with english strings.
When user launches it - I see user's phone locale, and ask my own server for necessary language file. (resource keys will be the same)
When new resource file comes, all interface should work with new file.
The question is how to change existing or add new string.xml file in runtime?
You obviously cannot change, download or remove strings.xml at runtime
If you want to store locations, you will have to use SQLite storage to store translations.
similar:
How to modify strings.xml file at runtime
run time modification of strings.xml
Now I can see only solution:
Create some "localization proxy" that will return me necessary resource (from string.xml or downloaded resource)
Replace all getString() and getText() to your own method getStringFromLocalization
Override TextView, Button and some other views with custom one and change there init and setText methods.
Overriding the standered resource/language using resource files which are complied time then your scarifying performance over customization. Do it only if u need this.

renaming the name of the APP alone in Android Eclipse IDE

I created a wonderful app, but I want to rename the "application name" alone... (i.e the name seen by the user on the app icon ) .. ( this isn't package renaming)
How do I do it, without creating a new one ...
In the strings.xml file, there is an element app_name which is used in the AndroidManifest's application element as the app's name. Just change the value of app_name in the strings.xml file to change the name of your app.
You don't need to refactor to change the name that people see. That is set in your res->values->Strings.xml file. You can call it what you want.
you can try Refactor -> rename.

Categories

Resources