Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8347185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:17:00+00:00 2026-06-09T07:17:00+00:00

I have made a project in which I am using different language’s xml,like language_hi.xml

  • 0

I have made a project in which I am using different language’s xml,like language_hi.xml,language_en.xml. so according to documentation I have made different folder for my each xml. For example for language_hi.xml I have made es/values-hi for language_en I have made res/values-en and in my each xml the string name is same,is there any way to select language_en.xml on one button click and language_hi.xml on another event.

this is my xml

res/values-hi/language_hi.xml

<string name="hello">sachit</string>

<string name="app">colon</string>

res/values-en/language_en.xml

<string name="hello">astro</string>

<string name="app">dev</string>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:17:02+00:00Added an answer on June 9, 2026 at 7:17 am

    You can select the Locale to use at runtime; for example, setting it to English will result in the values from the res\values-en\... folder being used.

    To do this, the following code is necessary:

    Resources res = getResources(); // From your context
    DisplayMetrics dm = res.getDisplayMetrics();
    Configuration conf = res.getConfiguration();
    conf.locale = new Locale("en"); // For English
    res.updateConfiguration(conf, dm); // Now, update the language
    

    However, I strongly recommend against using this. When a user runs an app, they expect it to either be in the default language (which in many cases is English), or their localized language. Giving someone an app in Hindi, for example, when they are in Russia, is really no good.

    Keep in mind, that if you are using en for your entire app, getting a value from languages_hi.xml is incredibly difficult and, really, should not be done in any situation. An application should be the same language throughout, or it will begin to confuse the user (with the exception of apps that handle translations between languages). However, if you are interested in doing this (for whatever esoteric reason), you should review this answer.

    PS: I assume you know this, but I should mention it anyway. Any strings in the res\values\... folder are used if the locale which the phone uses is not specified using res\values-xx\.... You can find information on this here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made a project in which i have added a splash screen by
I have a Django-project which was running fine, until I made some changes I
I have been made a windows service.in which i have been added project installer.in
I'm using SAS Enterprise Guide 5.1 and I have a project made of 4
I am doing NDK profiling for my project using android-ndk-profiler-3.1. I have made changes
My question is rather simple I have made many changes in our project which
I have made a java project and want to deliver it to a client
I have a project made with PhoneGap 1.1. I don't want to upgrade to
I have made a new Excel 2010 Add-in project, with VS10. When I run
I have made a ViewController in XCode for an iPhone project I'm working on,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.