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
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.
Related
when i change my phone language it effect my App also,,i want that whatever the phone language as,,not effected my App layouts,for example my App is an English language i want the app language and layouts remain same,,while phone language keep changing
Changing the language is considered a configuration change, just like rotating the device or switching the UI from light- to dark mode. Your activity is then recreated and loaded with the appropriate resources.
If you wan't to handle a configuration change yourself, you need to specify this in your manifest for your activities as stated here.
<activity android:name=".MyActivity"
android:configChanges="locale"
android:label="#string/app_name">
You can find other valid values for configChanges here.
Is there any way that the user can choose the application name and launcher icon of my app and set it programmatically?
I want to give the permission to user so that he can rename my application and also change the launcher icon of the app.
Is there any solution to this?
The only thing you can do is to define multiple Launcher Activities with pre-defined icons and labels, and enable/disable them programmatically.
setComponentEnabledSetting (ComponentName componentName, int newState, int flags)
It is not possible to change either of these values easily. You could create new Launcher Icons from inside the app, and then control them easier - like the other answer suggests).
Bottom line, this is not easily done using standard Android framework to the best of my knowledge.
I have an Android app with a pretty long name. This name is 'compacted' when presented under the app icon in the launcher (tested on 2.2 up to 4.0). That's both ugly and stupid (you can't see the actual app name).
I would like to change this icon label without affecting the name that can be seen in the App Manager. Is this possible?
Sure. The caption of your launcher icon is driven by the android:label attribute of whatever <activity> has the magic <intent-filter> to appear in the LAUNCHER. By default, that is set up to be the same string resource (#string/app_name) as is used for the <application> android:label, but you can have your <activity> point to a different string resource.
Am doing a danish project, so when i long press in the edit text box i need the "Edit", "copy", "paste" etc commands in danish. In my phone there is no danish language can be selected.
any help is appreciated.
thanks in advance....
jibysthomas
I think you have to use Typeface for using Danish language without selecting Danish language from your phone language.
And for long press dialog I think you have to make your custom dialog and use that. I am not sure but this is my idea.
Thanks.
I use "Scandinavian keyboard " and when i need it press and hold the input box and change the "input method" to this keyboard
https://play.google.com/store/apps/details?id=com.android.inputmethod.norwegian&hl=es
hope it works 4 you
Your Android build must support each localization for the system menus to appear in the desired language. Yes it is possible to support a language by overriding the system menus but if you use Danish as your default language in the app and the system language is set to Danish the system menus will appear in Danish.
Download a custom locale app from the market and use it to change your phone locale to Danish. In your app, you then need to support localization. Read this document on localization. It helped me a lot when I was localizing an app. Briefly, you will need to create a "values-da" folder under res, create strings.xml and define the strings you need with your Danish values. Don't forget that you need to have a strings.xml file in your regular "values" folder as well with all the strings defined. This folder represents the default string values, and is useful to fall back on if a string is not found in your "values-da" folder.
Trust me, the whole process is actually a lot easier than it sounds.
I know that we can set it through manifest file using android:icon attribute.But how can we set it in java code?
It doesn't make sense to set it programmatically, the launcher has to display the application icon when the application isn't active.
If you take a look at How to change an application icon programmatically in Android?, you will find a comment, which links to this sample code in the Android developer API demos: LaucherShortcuts.
It seams that the Activity can create a LauncherShortcut, which can have a different icon (see function setupShortcut()). If you want the user to select the Icon, you have to display a list of icons when creating the shortcut. But again, it is a shortcut. In the list of application the original icon appears.
I dont think the launcher icon can be set programatically.