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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:58:06+00:00 2026-06-17T11:58:06+00:00

I am using ProgressDialog in my app but on running the app errors occurred.

  • 0

I am using ProgressDialog in my app but on running the app errors occurred.

Here is the code

   public class MainActivity extends Activity{


    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

        ProgressDialog mDialog = new ProgressDialog(getApplicationContext());
        mDialog.setMessage("Loading...");
        mDialog.setCancelable(false);
        mDialog.show();

    }
}

Updated Code:

public class MainActivity extends Activity{

public static ProgressDialog dialog;


public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);



}


 private static abstract class DictionaryOpenHelper extends SQLiteOpenHelper {



     public DictionaryOpenHelper() {
        super(null, null, null, 0);
        // TODO Auto-generated constructor stub
    }



    public void onCreate() {
        // TODO Auto-generated method stub

        ProgressDialog dialog = ProgressDialog.show(DictionaryOpenHelper.this, "", 
                "Loading. Please wait...", true);  

    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        // TODO Auto-generated method stub

    }


 }

}

and give error on ProgressDialog dialog = ProgressDialog.show(DictionaryOpenHelper.this, “”,
“Loading. Please wait…”, true); :

The method show(Context, CharSequence, CharSequence, boolean) in the type ProgressDialog is not applicable for the arguments (MainActivity.DictionaryOpenHelper, String, String, boolean)

  • 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-17T11:58:07+00:00Added an answer on June 17, 2026 at 11:58 am
        Caused by: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
    01-18 06:26:07.273: E/AndroidRuntime(3853):     at android.view.ViewRootImpl.setView(ViewRootImpl.java:524)
    

    Load and Unload Progress Dialog Can be Attempt with the Following Snippet
    make it a part of UIThread
    ///load

      private ProgressDialog pDialogTh = null;
          private void showLoading() {
            runOnUiThread(new Runnable() {
                public void run() {
                    // if(pDialog==null)
                    pDialogTh = ProgressDialog.show(YourActivity.this, "", "Loading...",
                            true, true);
                    pDialogTh.setCancelable(false);
                    if (!pDialogTh.isShowing()) {
                        pDialogTh.show();
                    }
                }
            });
        }
    

    ///////Unload

    private void hideLoading() {
        runOnUiThread(new Runnable() {
            public void run() {
                if (pDialogTh.isShowing()) {
                    pDialogTh.cancel();
                }
            }
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the following code class AddTask extends AsyncTask<Void, Void, Void> { ProgressDialog
I am using the code from this website (http://www.helloandroid.com/tutorials/using-threads-and-progressdialog) in my App. It is
hey i want to display a loading progress using ProgressDialog on my aplication, but
I'm using AsyncTask in my custom Dialog. AsyncTask works fine in activity, but inside
This is my first android app. I am posting the code I am using
I'm sure this is a simple threading issue but... I'm starting a ProgressDialog using:
Possible Duplicate: Transparent, borderless ProgressDialog I'm using Theme.Light in my app. While using Progress
I am using a ProgressDialog for Loading data..... Can I set it up for
I'm using undetermined ProgressDialog with text 'Loading...' and other similar texts. I decided to
I have a common class say for eg Class A which extends AsyncTask and

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.