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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:17:00+00:00 2026-06-07T15:17:00+00:00

I have a strange problem. When I run app and click button (btn_eng or

  • 0

I have a strange problem. When I run app and click button (btn_eng or btn_pl) i see log in logcat (“Erase dialog” or “Erase dialog PL”) but next time when i click it does’t show up and button doesn’t do their onClick action.
I tried to make buttons to change language. In my app I have a dialog with data form Resources (string array) and when I change language i want erase dialog and make new with adequate data.

    //public static Activity act; -> before onCreate(..)
    this.act = this;

    Button btn_eng = (Button) findViewById(R.id.btnEN);
    btn_eng.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Log.d("XXX", "Erase dialog");
            act.removeDialog(1);
            Locale locale = new Locale("en");
            Locale.setDefault(locale);
            Configuration config =   act.getBaseContext().getResources().getConfiguration();
            config.locale = locale;
            act.getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
            act.setContentView(R.layout.main);

        }
    });

    Button btn_pl = (Button) findViewById(R.id.btnPL);
    btn_pl.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Log.d("XXX", "Erase dialog PL");
            act.removeDialog(1);
            Locale locale = new Locale("pl");
            Locale.setDefault(locale);
            Configuration config =   act.getBaseContext().getResources().getConfiguration();
            config.locale = locale;
            act.getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());

            act.setContentView(R.layout.main);
        }
    });
  • 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-07T15:17:01+00:00Added an answer on June 7, 2026 at 3:17 pm

    Its because you are resetting the content view in your onClick. Calling setContentView does not cause onCreate to be run – and that is where (I’m guessing) you link the onClick listener to the button. It does however cause a whole new instance of your layout to be displayed. You need to find a new way to refresh your screen, not replace your screen, with your new data. The best way would be to grab the wrapping ViewGroup for you activity and call View#invalidate();

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

Sidebar

Related Questions

I have run into a strange problem, i am creating a lot of dynamically
I have run into a strange problem on Android , using jQuery mobile and
I seemed to have run into a strange problem with the CCParticleSystem and the
I have a strange problem with in-app billing RESTORE_TRANSACTION command. Every request RESTORE_TRANSACTION request
I have strange problem with run .exe program in my WebApplication. It works fine
Good day! I have strange problem with Xcode 4.3. When I'm trying to run
I have a strange problem with my app, sometimes, very rare in fact, when
Very strange problem with my iPhone App. We have an App that has been
I've recently hit a strange problem with my iOS app and have no idea
I have this very strange problem on a big flex app where it would

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.