3

Is it possible to set the R.String.app_name during the running of the application.

Due to language setting

When the user wants the application in English I want to change the name of the application to an English name

and when he wants the application in Arabic I want to change the name of the application to an Arabic name.

Hanihh
  • 305
  • 1
  • 4
  • 13
  • 1
    i don't sure but,try localization this http://developer.android.com/training/basics/supporting-devices/languages.html – Stack Overflow User Jun 22 '13 at 10:35
  • 2
    That is what strings file is for. It allows for internationalization out of the box. http://developer.android.com/guide/topics/resources/localization.html – John Jun 22 '13 at 10:35
  • But I want the user to choose his preferred language from the first run of the application and store that choice for him. – Hanihh Jun 22 '13 at 10:57
  • @Hanihh it is always recommended that the device itself selects language rather than to let user decide the preferred language, all the below mentioned post are based on this recommendation.. –  Jun 22 '13 at 11:38

2 Answers2

1

To localize for arabic:

  1. Translate your strings.xml
  2. Create a new folder values-ar under /res and put your new strings.xml there

The user's device will automatically pick the correct localization based on its current locale.

Steven Huang
  • 490
  • 4
  • 16
1

You can support localized names of application by provide different string files for different localizations: http://developer.android.com/training/basics/supporting-devices/languages.html In this way, your application in launcher will show name depending of device's current locale.

Also, you can change your app name in runtime by calling setTitle() of your application object. But please note that after closing of application, name will be resetted to default.

There is no way to change application name in runtime with saving it forever.

Dimmerg
  • 2,113
  • 1
  • 13
  • 14