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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:18:58+00:00 2026-05-22T18:18:58+00:00

I want to show a spinning wheel dialog while my app loads some data:

  • 0

I want to show a spinning wheel dialog while my app loads some data:

Spinning wheel dialog

The spinning wheel dialog should show on a button click. I’m using the code below but it does now show the spinning wheel. What could be the problem?

public void CheckAccount(String username, String password) {
    try {

        final ProgressDialog progDailog = ProgressDialog.show(this,
            "Progress_bar or give anything you want",
            "Give message like ....please wait....", true);
        new Thread() {
            public void run() {
                try {
                    // sleep the thread, whatever time you want. 
                    sleep(1000);
                } catch (Exception e) {
                }
                progDailog.dismiss();
            }
        }.start();

        //getting data code here
        //getting data code here
        //getting data code here
        //getting data code here
        //getting data code here

    } catch (Exception e) {
        Log.e(LOG_TAG, e.getMessage());
        PopIt("CheckAccountError", e.getMessage(), "Denied");
    }
}
  • 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-22T18:18:59+00:00Added an answer on May 22, 2026 at 6:18 pm

    So, seeing that this answer is getting more and more upvotes, I have decided that I should take it upon myself to improve the quality of the answer. As I look at the original, I see no real ‘answer’ to the question of “what is the problem in my code?”. I am leaving the original answer intact below to preserve the linking, which is what I am assuming has caused the answers popularity.

    Updated Answer

    It is likely that you are violating the ‘single thread model’. The Android UI Toolkit is not threadsafe, and should only be manipulated from the ‘main’ UI thread. Android has a handful of helpful methods you can use to ensure that your UI manipulations are done on the UI thread. Most of the details of these method calls can be found in the Android Painless Threading blog post (linked in the word ‘one’ below, and here for quick reference).

    Looking at your code, the specific violation I see is that a ProgressDialog is being created in what is likely the UI thread, which is then dismissed in the newly created background thread.

    You would be better off encapsulating your background method in a Runnable and using View#post(Runnable) to do the work in the background.

    Remember, there are many ways to do background, so take a look at what is available, and use what feels right for your situation.

    Original Answer

    Take a look at one of the many tutorials of how to do asynchronous work in Android.

    Also, here are some other StackOverflow questions that are similar

    Progress dialog problem in Android

    Progress Dialog on open activity

    Progress Dialog while starting new activity

    Android: Progress Dialog spinner not spinning

    Updating progress dialog

    android: showing a progress dialog

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

Sidebar

Related Questions

hii I want show a pop up Dialog box when i click on to
I want to add that spinning wheel image effect while loading all my images
I got an ios app, where i want show content on some pages, like
I want to show alertview with message: Loading data and spinning activity indicator. How
I have a button. When I click that button I want show a animated
i want to show spinning wheel progress but it doesn't show anything. final ProgressDialog
I want show a web page (google) when i click on the button in
I want to show a Dialog, I am using jquery ui with asp.net mvc
My problem is pretty common. I want to show some loading stuff while the
I use : Window.showModalDialog(...) to open a dialog window, I want show some HTML

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.