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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:05:42+00:00 2026-05-23T07:05:42+00:00

I have a client software (on Android) that listens to incoming messages. The messages

  • 0

I have a client software (on Android) that listens to incoming messages. The messages are received in a while loop that waits for messages to come. When a message is found, it updates the GUI. [Since in Android, GUI can not be updated directly ] A thread is called to do this. My problem is, if there are many messages, results in many threads! And it creates a clumsy situation. My abstract code is,

My_Client()
{
  send_text_function() // My question is not about it
  in_a_thread_Call_receive_from_others_function() [see 1]
}

receiving_funtion() // [this function is mentioned above as (see 1), called in a thread]
{
  while( waiting for new message)
  {
    >>A new message found >> create a thread to update the GUI.  // << Here is my question. see 2
  //android.os.Handler.thread type thread!
  } 
}

label 2: Now this thread is created each time there is a message. How can I just create one thread and keep using it again and again? Any idea?

  • 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-05-23T07:05:42+00:00Added an answer on May 23, 2026 at 7:05 am
    1. Create a new Thread.
    2. In the run() method of the Thread create a new Handler.
    3. When you want to do something on the target thread, use the Handler’s post() method.

    You can create a Handler on the Main thread to post-back operations that update the GUI.

    Also consider using AsyncTask<>.

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

Sidebar

Related Questions

So in the past I have always developed windows forms client software while inside
Here is my requirement. I have a client that was sending a specific message
I have a client who needs an Android App that can recognize spoken commands.
I've have a client that is using a third party piece of web software.
We currently have 4 installers for our client software: ClientSetupTest ClientSetupProduction ClientUpdateTest ClientUpdateProduction The
We have a software product that evolves at the rhythm of clients' needs and
I have client application that uses WCF service to insert some data to backend
Question: I have to come up with unique ID for each networked client, such
I have a client software program used to launch alarms through a central server.
I have an iPhone app that is a client for an existing server application.

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.