In this article, we will develop an Android application which displays TextView content and Activity title in French language.
This application is developed in Eclipse (4.2.1) with ADT plugin (21.1.0) and Android SDK (21.1.0) .
1. Create a new Android application project namely “LngLocalAppSpecific”
2. Configure application project
3. Design application launcher icon
4. Create a blank activity
5. Enter MainActivity details
6. Update the file res/values/strings.xml
<?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">Application Specific Localization</string> <string name="action_settings">Settings</string> <string name="hello_world">Hello world!</string> </resources>
7. Create a folder namely values-fr in the folder “res”
8. Create an xml file namely strings.xml in the folder res/values-fr
<?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">Localisation d\'applications spécifiques</string> <string name="action_settings">réglages</string> <string name="hello_world">Bonjour tout le monde!</string> </resources>
9. Update the file src/in/wptrafficanalyzer/lnglocalappspecific/MainActivity.java
package in.wptrafficanalyzer.lnglocalappspecific; import java.util.Locale; import android.app.Activity; import android.content.res.Configuration; import android.os.Bundle; import android.view.Menu; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Creating an instance of Locale for French language Locale locale = new Locale("fr"); // Creating an instance of Configuration Configuration config = new Configuration(); // Setting locale of the configuration to french language config.locale = locale; // Updating the application configuration getBaseContext().getResources().updateConfiguration( config, getBaseContext().getResources().getDisplayMetrics() ); // Setting the title for the activity, after configuration change setTitle(R.string.app_name); // Setting the layout for the activity setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } }
10. Screenshot of the application in action
11. Download source code


I am George Mathew, working as software architect and Android app developer at wptrafficanalyzer.in
You can hire me on hourly basis or on project basis for Android applications development.
For hiring me, please mail your requirements to info@wptrafficanalyzer.in.
My other blogs
store4js.blogspot.com