Change the language settings (locale) for the device

I know that it is possible to have several languages ​​in one application via res / string and depending on Locale. Here is the case (ANDROID) controlling the user's language

Now, how can I change the language on the phone? As I would do Menu> Settings> Language and keyboard> Select language> Languages

Is there any real code to access these settings? Or should I create an intention for quick access to language settings. Please post code

Edit: With the Locale class developer.android.com/intl/fr/reference/java/util/Locale.html

Constructor at least Locale (String language) Input is a language. How can you get the current language used on the device?

+18
android settings locale
Apr 07 2018-10-22T00:
source share
5 answers

Not sure if you need to install it directly from the application, but if you want to send it there to change it yourself, try the following:

Intent intent = new Intent(Intent.ACTION_MAIN); intent.setClassName("com.android.settings", "com.android.settings.LanguageSettings"); startActivity(intent); 
+40
Apr 7 '10 at 23:03
source share

There is another way to open the system settings for changing the language:

 Intent i = new Intent( android.provider.Settings.ACTION_LOCALE_SETTINGS ); startActivity( i ); 

It shows only a list of languages, and when you select one, it changes the language on the device.

+11
Jun 02 '13 at 17:09
source share

I found another answer to my question. There is an open source project code.google.com/p/languagepickerwidget It recreates ListActivity to display and select languages.

Jim, your decision is very simple and exactly what I need. This is a binding to the settings. Immediately after publication, I launched an application called "raygional" onto the market. If I could (I have only 6 points), I would make your answer useful.

There is another way to see processes and intentions. On the emulator, go to Menu> Developer Tools> Development Settings> and click "Show Running Processes"

+6
Apr 10 '10 at
source share

As far as I know, the only way to change Locale devices without using intentions (as other solutions suggest) is to access inner classes through reflection (taking into account the risks that this implies).

Here you can find an exact example of this use case: http://www.tutorialforandroid.com/2010/07/access-internal-classes-in-android.html

+3
Aug 19 '12 at 14:37
source share

To deploy Jim if you change the intent to:

 intent.setClassName("com.android.settings", "com.android.settings.LocalePicker"); 

It will disable the user directly in the language selection list, and after selecting the language, he will return to your application.

It removes the click, does not make the user think about which of the three (language, dictionary and keyboard) to choose and will immediately return to your application after selection.

+1
May 18 '12 at 16:12
source share



All Articles