Use this to change the language by code -
Locale locale = new Locale("en_US"); Locale.setDefault(locale); Configuration config = new Configuration(); config.locale = locale; context.getApplicationContext().getResources().updateConfiguration(config, null);
Enter the country code instead of "en_US" in any language you want ... for example, for japanese - "ja_JP" For Arabic - "ar" or check this link for the country code -
http://code.google.com/apis/igoogle/docs/i18n.html
And create a folder in res / values-ja for japanese or res / values-ar for arabic.
And create a string.xml file. Put the languages on your layout. It will select the default language from the values folder, otherwise you want it manually, then it will extract the external folder-ar from your values, etc., How ...
His res / values-ar example for Arabic is
<?xml version="1.0" encoding="UTF-8"?> <resources> <string name="spinner_label">تصفية حسب</string> <string name="app_name">2011 فرق</string> <string name="search">بحث :</string> </resource>
Hope this helps you.
source share