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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:46:16+00:00 2026-06-04T21:46:16+00:00

In my application , i have 3 buttons A,B,C . on the press of

  • 0

In my application , i have 3 buttons A,B,C . on the press of button A, i am doing some computations that takes some time … in that period , i want to disable the other two buttons. I am providing the code for the onClick listener for one button..

case R.id.buttona:

    //Disabling other two buttons
    start1b.setVisibility(v.INVISIBLE);
    start1c.setVisibility(v.INVISIBLE);
    stop1.setVisibility(v.INVISIBLE);

        //this is the process that takes time 
    String x ="/databank/Reading18.wav";
    timedata1a = fe.returningtimedata(x);

    rawdata1a = fe.returningrawdata(x); 
    Log.d("now press", "button");

    //features of Reading 1 hav been extracted into timedata1a 
    start1b.setVisibility(v.VISIBLE);
    start1c.setVisibility(v.VISIBLE);
    stop1.setVisibility(v.VISIBLE);

break;

but when i press 1 button A and then immediately press button B , the application force closes .. can any1 help ??

  • 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-04T21:46:19+00:00Added an answer on June 4, 2026 at 9:46 pm

    you need to perform operations which you want to perform in disabled state in other thread than UI. cause event thread never gets time to disable the buttons. so You can do following:

    case R.id.buttona:
    
        //Disabling other two buttons
        start1b.setVisibility(v.INVISIBLE);
        start1c.setVisibility(v.INVISIBLE);
        stop1.setVisibility(v.INVISIBLE);
    
         Thread thread=new Thread()
         {
            public void run()
            {
    
                     //this is the process that takes time 
                      String x ="/databank/Reading18.wav";
                      timedata1a = fe.returningtimedata(x);
    
                     rawdata1a = fe.returningrawdata(x); 
                     Log.d("now press", "button");
                     handler.sendEmptyMessage(1);
    
    
    
              }
           }
           thread.start();
           break;
        }
    

    You need to define a handler to post results back to UI thread after thread processiing completes.

    Handler handler=new Handler();
    {
        public void handleMessage(Message msg)
        {
             int what=msg.what;
             switch(what)
             { 
                case 1:
                      {
                           //features of Reading 1 hav been extracted into timedata1a 
                         start1b.setVisibility(v.VISIBLE);
                         start1c.setVisibility(v.VISIBLE);
                         stop1.setVisibility(v.VISIBLE);
                      }
                      break;
                 .........
             }
        }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have application with Listbox and files, each time i press on Add button
What I´m doing: Have a application with player The user press the Play button,
In Application i have two buttons in which one button is used as a
In my application I have some link buttons there but when I right click
I have a group of radio buttons in my Swing application that have a
In my application I have several activities, the main screen has 4 buttons that
I have an application that has a list of buttons and has customized tooltips.
I have two windows in separate applications. The first application has a button that
I have 3 buttons in total. And it seemed that, if I don't press
I've got a little Problem: I want to have Buttons in some of the

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.