Android Multi Language Support Tutorial With Example

Android is the Most used Mobile Platform across the world. With more than 2 Billion+ active users per month, and a Share of 87.1% market share of the total Mobile Devices used worldwide, Android has a wide range of users from different regions which truely requires the feature of Android Multi Language Support.

To reach out to wide range of audience and to leverage the most out of our app, we need to support Multiple Languages in our App. This Android Multi Language support tutorial is targeted right at this.

In this article, we will be creating an App which supports English and Hindi Languages. We will use Android Shared Preferences to store our selection so that the app retains whatever Language we’ve selected even after leaving the app and coming back again. So lets begin this exciting tutorial on Android Multi Language support.

android multi language support

 

My idea here is to create a project with Navigation Drawer and some text and image inside which will be swapped with the respective language resources and labels based on our Language selection.

Here’s our project will look like upon completion:

 

You can add Android Multi Language Support to your Android Application in 4 simple steps:

1. Creating New Project for Android Multi Language Support Example

Here I will be creating a new project selecting Activity Template as Navigation Drawer Activity as shown in the image below.android multi language support example - selecting navigation drawer activity

Other than this, I kept everything as default and created a new project.

2. Modifying project’s Layout

Here i will be modifying our Android Multi Language Support project’s layout accordingly. I am adding an ImageView and TextView whose resources are to be swapped when switching between Languages.

3. Adding the required Translation Strings

Here we will be modifying our Strings.xml file and add the following strings to it:

Here I’ve created a new Folder named values-hi to place the strings.xml with Hindi translations in the path as shown in the image below:

android multi language support - location of strings.xml file

Since we are adding hindi translation, i’ve created folder values-hi.  If you also want to support Spanish, you can add another folder named values-es and place another strings.xml file with the required translations to spanish. Thus we’ll be adding various translation files in respective folders accordingly.

Now I’ve added the translation strings.xml with the content for Android MultiLanguage support as follows:

4. Modifying our Activity File to do support Android Multi Language Support

Now we will be changing our Activity file to switch between multiple languages. The code is commented wherever required.

The required images are added to drawable folder accordingly which can be downloaded from the github link below that contains source code for the project created for this Android Multi Language Support tutorial.

Vamsi Tallapudi
Connect Via

Vamsi Tallapudi

Founder and Author at Code Refer
Android Dev, Tech Enthusiast and Blogger. Ever since my first basic android app has reached lakhs of users, I've found myself in love with Android Development.
Vamsi Tallapudi
Connect Via

Vamsi Tallapudi

Android Dev, Tech Enthusiast and Blogger. Ever since my first basic android app has reached lakhs of users, I've found myself in love with Android Development.

You may also like...