Change text-language in android - android

my android app is nearly finished.
finally i wanna give the possibility to change the texts shown on the activitys between english and german.
is there an easy way to do this?

Actually, I can imagine the situation where you want to change language of app at runtime. For example you could have an application for which you change language on the web and want to have the same setting on a phone. I had myself similar problem recently. I think this article can help you doing
http://www.tutorialforandroid.com/2009/01/force-localize-application-on-android.html
It is a matter of updating configuration.

Isn't it better to let user decide their locale and language settings through android itself ?
Regards,
Stéphane

Related

Android: Change Languages (string.xml) programmatically

In our Android app, we have an option for the user to change the language, which means he can select whether he want to use English or Sinhala. The default is always in English. We have one string.xml for English and another for Sinhala.
I was referring Android documents about "localization" but that is not exactly what I am looking for, I can't ask the user to change his phone settings. I also noticed programmatic localization which is discussed in here but most users do not recommend it due to loads of errors (anyway these posts are pretty old)
So, what's the best way of changing the String?XML file, with the preferred language of a user? It seems not easy on Android.
Or, is this is simply not a good idea?

Regarding Multiple Language Application for Android?

I am trying to make small app for android. My idea for app is that user can change the language whichever they want ...etc french , german,chinese , english etc...
how to force the locale language in my app or how to get access to the language used by user on their device and with respect to that I can change my application language.
THank you,
For this you may need to make use of Localization.
Please go through the following example available at the developer site.
May be this can solve your issue.
http://developer.android.com/resources/tutorials/localization/index.html

Select a language from android app?

In my android app I need to do something like this: I have 5 languages. When app starts the user choose one of them from a spinner list. For each language there is a string.xml file. The question is: there is possible what I'm trying to do or not?
Implement the tutorial for localization.
It's only only a few steps and well-explained.
A setup like that would be unneccessary as the Android system handles this. Having your different language xml files will suffice (make sure you name them correctly, see the link posted by Raz). Android picks out the right file based on the language selected by the user within the Android OS settings.
Yes, you can do this by changing the Locale of the application. There's a similar question in here, see Changing Locale within the app itself
Yes, it is. Details: http://developer.android.com/guide/topics/resources/localization.html

Android application icon changes with runtime

In my app I want to display different icons for the application. Changes should be according to the scenario. For example, it will mark the number of days remaining for the task completion. On the android menu this icon will display the number of days remaining. If anyone has any idea for this, I would appreciate it. Thanks.
There are actually a number of ways to achieve this. If you notice Google's clock app these days, it does show the current time.
You can refer to this tutorial: https://blog.jakelee.co.uk/programmatically-changing-app-icon/
Or find even more ways here: How to change an application icon programmatically in Android?
As far as i know, you cant. Also refer to this answer:
Android Application Icon Change
I am afraid you can't change your app's icon programmatically. How to change an application icon programmatically in Android?
This can be done easily. Within your activity code, just write:
getActionBar().setIcon(R.drawable.new_icon);

Launch app with specific locale

Changing the locale for a device is done in the settings, and can't be done by an app AFAIK.
I know how to force my own app to a specific locale, described e.g. here:
http://www.tutorialforandroid.com/2009/01/force-localize-application-on-android.html
So now to my question. Can I force, programatically, the local of an activity that isn't mine?
I can imagine 2 ways this could be possible:
Specifying the locale in an Intent used to start the activity.
Access and manipulate the configuration of running activities (in the same way as I can modify my own activities' configurations).
Any thoughts? Is it possible? Is it reasonable?
I guess 2. would be more direct, but require some kind of permission (e.g. the modified atcitiy must allow it in the manifest file). But I'd settle for 1. or similar.
What I want is to be able to see certain apps in a different language, but rather not change the system locale. E.g. the Android Market, that only displays comments in one language. Can't think of other things right now.
Can't find much written on Locale in the documentation, what is and isn't possible. But hoping some undocumented feature might enable this :)
You can't unless the activity you are calling accepts a special locale parameter.
So, you can implement this with two of your own apps, or with the app of your friend, but there's no general way of doing this.
The only way I can imagine is to programatically change the locale of the whole device.
But I think you can only open up the preference screen and need the user to choose the correct locale before starting the app.

Categories

Resources