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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:34:39+00:00 2026-06-15T09:34:39+00:00

I am handling a thread in my application, I am facing a problem with

  • 0

I am handling a thread in my application, I am facing a problem with Thread wait function. I created and show my UI using runOnUIThread() , my main thraed was waiting for my UI thread to finish ,after thraed finishes i have do some process in Main thread , here the problem is that Main Process is always in waiting state even my thread finishes it;s job I am using wait and notify() function for this

      public String LSVerification() {

        String t = null;

            t="Sample string";
            synchronized(this)

            {
            AndroidHTMLActivity.this.runOnUiThread(ShowDialog) ;//here i call my thread

            try {
               this.wait();//here i waiting for my thread to finish it's job

            //here i do some process after my thread finish it's job
              //the problem is here main process always in wait state


                } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            }
          return t;        
        }

        private Runnable ShowDialog = new Runnable() {
            public void run() {
                String t = null;
        synchronized(ShowDialog)

            {
            Recognition recg=new Recognition(Activity.this);

                recg.show();


            this.notify();
            }

            }
        };
  • 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-15T09:34:40+00:00Added an answer on June 15, 2026 at 9:34 am

    try to use Hanlders to update UI after performing a job in background…

    Link to Handlers See Code below..

    private void performOperationInBackgroundThread() {
            Thread Servicethread = new Thread(
                        new Runnable() {
                            public void run() {
                                try {
                                    PerformThreadOperation();
                                    DataLoaded = true;
                                } catch (Exception e) {
                                    ExceptionOccured = true;
                                    e.printStackTrace();
                                    System.out.println(e.getMessage());
                                }
                                handler.sendMessage(handler.obtainMessage());
                            }
                        }
                        );
                Servicethread.start();
            }
    
    
     static class MyHandler extends Handler{
                    MyActiviy parentActivity;
                    @Override
                    public void handleMessage(Message msg){
                        // Update your UI here
    
                        }
                    }
    
                    MyHandler(MyActiviy activity){
                        parentActivity = activity;
                    }
                }
    
    MyHandler handler = new MyHandler(this);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a problem with handling an event on a different thread from where
I'm writing an application that listens on UDP for incoming messages. My main thread
My application has a message-only window that is launched from a newly created thread.
I'm currently building a Java application using two threads : The first thread is
My objective is a convention for thread-safe functionality and exception handling within my application.
i have one problem with handling the thread in android ,in my class i
Could someone please tell us on how to print correctly the handling thread in
I need to implement handling of redelivery of JMS messages in the application that
In my 3.5 .net web application I have a background thread that does a
Background: This is a follow-up question to this thread about handling EINTR for system

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.