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 7993597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:54:05+00:00 2026-06-04T13:54:05+00:00

I am working on an Android app which needs to be bilingual (English/Spanish). I

  • 0

I am working on an Android app which needs to be bilingual (English/Spanish). I allow the user to select the desired language from a Preference and perform the following locale change in the app’s main activity (a subclass of TabActivity) based on the selected language:

private void setApplicationLanguage(String languageCode)
{
    // Set the locale to the specified language code.
    Resources res = getResources();
    DisplayMetrics dm = res.getDisplayMetrics();
    android.content.res.Configuration conf = res.getConfiguration();
    conf.locale = new Locale(languageCode.toLowerCase());
    res.updateConfiguration(conf, dm);
}

The main activity hosts four tabs, each with its own Activity (sometimes ActivityGroup). What I would like to have happen is when the language changes, all open activities are simply restarted which causes their strings to be reloaded in the appropriate language. Also acceptable (but less desirable) would be total destruction of all the open activities, requiring the user to start the app again manually and thus all the strings would be reloaded in the appropriate language.

I have tried calling finish() from the main activity which causes that activity to quit. However, when I restart the app, the child activities “hosted” by the main activity (one for each tab) still appear in the prior language. I assume this is because the child activities weren’t recursively “finished” for me.

I have also tried including/excluding the “locale” attribute from AndroidManifest.xml on the main activity as well as other activities, but I never see an activity restart upon a change in local. Then again, how would the “restart” manifest itself? Would it call onCreate() or simply onResume(), or even something else? If this approach would automagically restart the activities, calling onCreate() when the locale changes, then it sounds like specific guidance on how to make this happen would be the best route in my case.

The solution needs to run on Android API level 7, so creating a new Intent with the flag FLAG_ACTIVITY_CLEAR_TASK apparently is not available option.

  • 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-04T13:54:06+00:00Added an answer on June 4, 2026 at 1:54 pm

    You can use a BroadcastReceiver as an inner class of each Activity used for the tab content.

    Register the receiver in onResume and un-register it in onPause.

    Have the main Activity send a ‘sticky’ broadcast when the locale is changed and use the result of registerReceiver in onResume to retrieve the Intent to see whether the locale has changed. This should also work for any ‘visible’ Activity to allow it to dynamically update the data.

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

Sidebar

Related Questions

I'm an Android newbie, and working on an app which needs an Options menu.
I am working on an Android app, for which I would like the user
I am working on an app which needs to implement splitview functionality in android.
Iam working on an android app in which i get a response from a
I'm very new to webservices. Currently i'm working on an android app which needs
I'm working on an Android app in which I would like to use multi-touch.
I have made an android app which working fine. I implemented the Login functionality
I am working on an android app that has a database in which one
I have an app which was tested thoroughly and working fine on Android Gingerbread
I have an Android app that I had working a few months ago which

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.