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

  • Home
  • SEARCH
  • 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 7441465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:01:02+00:00 2026-05-29T11:01:02+00:00

Trying to show ProgressDialog, but getting: Can’t create handler inside thread that has not

  • 0

Trying to show ProgressDialog, but getting:
Can’t create handler inside thread that has not called Looper.prepare().

Here is my code:

    public class SocketThread implements Runnable {
    BufferedReader in;
    private ProgressDialog dialog;

    public void run() 
    {
        socket = null;

        while (true)
        {
            // Loop until connected to server
            while (socket == null){
                dialog = new ProgressDialog(getApplicationContext());
                dialog.setMessage("Connecting to " + gatewayString);
                dialog.setIndeterminate(true);
                dialog.setCancelable(true);
                AdvancedMultipleSeriesGraph.this.runOnUiThread(new Runnable() {     
                    public void run() {
                        dialog.show();

                    }
                });

Is it possible to fix?

  • 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-29T11:01:03+00:00Added an answer on May 29, 2026 at 11:01 am

    you can use an Handler and use Handler.post(Runnable) or, if you have an activity context you can use Activity.runOnUiThread(Runnable action)

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

Sidebar

Related Questions

I'm trying to show a custom hint in a TWinControl but I can't figure
I'm trying to show image files (jpg, png, gif) that can be larger than
I'm trying to test an Activity in android which will show a ProgressDialog and
I'm trying to show/hide a movieclip (or graphic) symbol that is on a layer
I am really trying to show what htmlentities gives me, but it doesn't give
I'm trying to create a ProgressDialog for an Android-App (just a simple one showing
HI, Im trying to show a ProgressDialog while the activity is loading. my problem
I am trying to have a ProgressDialog appear when I am getting some data,
I am trying to show a spinning progress while I load some data, but
I'm trying to show a dialog box that says waiting for GPS fix on

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.