0

I want add a settings for language to my app which is independent from system language.

I could manage to change language of anything but the launcher icon is still in system language.

Is it possible anyhow to change that icon language?

Metin

metinkale38
  • 718
  • 3
  • 10
  • 28
  • Just curious, why would you want the icon language different from the phone language setting? Would it not be inconsistent for the end user? – Ahmed Faisal Jan 17 '13 at 20:29
  • No, the end user will be able to edit the language in the settings, so this won't be a problem. – metinkale38 Jan 17 '13 at 20:37
  • Not sure if this meets your requirement but worth a try: http://stackoverflow.com/q/5551939/867591 – Ahmed Faisal Jan 17 '13 at 20:39
  • This would automatically pick the system language, but it should use the language from my app settings independent from system language – metinkale38 Jan 17 '13 at 20:43
  • 1
    i don't think you can do this. the system will pull the label attribute from it's own setting of locale, not what your application overrides. maybe make a nice widget for your users that takes their selection of language? – ggenglish Jan 17 '13 at 20:58
  • There are a few apps, in which you can select which subapps in this app should be shown in launcher. Maybe with multiple activitys and only one in launcher? May I could add the intent filter for the activity on boot? Would that work? Any other ideas? – metinkale38 Jan 17 '13 at 21:02

1 Answers1

2

Let's say that you are supporting N languages with this dubious feature.

You will need N entries in your manifest for the launcher activity. Each of those N entries will need an android:label pointing to a string that represents what you want displayed when your app is configured for -such-and-so language. You would then use PackageManager and setComponentEnabledSetting() to disable the old activity and enable the new one.

It is conceivable that you could use one <activity> element and N <activity-alias> elements to achieve your objective, but I am uncertain as to whether you can enable and disable activity aliases.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Yeah thank you that's I want. I won't have so many languages, so it wouldn't such a great thing. Do I have to call that setcomponentenabled... at each boot or once? – metinkale38 Jan 17 '13 at 21:15
  • @metinkale38: Once per language change. You would pick one of the activities -- whose label is in whatever your default language is -- to be enabled at the outset. The others would have `android:enabled="false"` in the manifest. Then, when the user changes languages, toggle which one is enabled and which is disabled. Note, though, that this may not take effect any time soon, as the home screen is welcome to cache this information, and there is nothing you can do about that. – CommonsWare Jan 17 '13 at 21:55
  • It seems like there isn't a perfect solution for that. Thanks anyway I will see what I can do – metinkale38 Jan 17 '13 at 23:00