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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:36:36+00:00 2026-05-18T12:36:36+00:00

I am trying to have a a progress dialog open when polling my server.

  • 0

I am trying to have a a progress dialog open when polling my server. The class is an ActivityGroup because it is nested within a tab bar. To keep the view within the frame, the ActivityGroup is needed. Here is the declaration of my ActivityGroup class:

   public class CheckInActivity extends ActivityGroup{
        ...
        public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.checkin);
            new LocationControl().execute(this);

Now my AsyncTask class is within the same CheckInActivityClass as such:

private class LocationControl extends AsyncTask<Context, Void, Void>
    {
        private final ProgressDialog dialog = new ProgressDialog(CheckInActivity.this);

        protected void onPreExecute()
        {
            this.dialog.setMessage("Determining your location...");
            this.dialog.show();
        }

When I run the given app it throughs an error relating to WindowManager$BadTokenException. Stating the it cannot start the window with an unknown token. I tried making a sample app that is just a regular Activity(not ActivityGroup) and it worked just fine.

Does anyone know how to modify this to make it work, or a work around that will allow the progress bar to be nested within the tab bar? Any help is greatly appreciated.

  • 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-18T12:36:37+00:00Added an answer on May 18, 2026 at 12:36 pm

    If the ActivityGroup is within a TabActivity you have nested activities with more then two levels. Android doesn’t support this at the moment but there is a workaround. You have to pass the parent activity to the dialog.

    Create a helper method for this purpose in the activity class:

    private Context getDialogContext() {
        Context context;
        if (getParent() != null) context = getParent();
        else context = this;
        return context;
    }
    

    Then change the line

    private final ProgressDialog dialog = new ProgressDialog(CheckInActivity.this);
    

    to

    private final ProgressDialog dialog = new ProgressDialog(getDialogContext());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to use a .gif file from my resources, but I
I have a class which extends AsyncTask, which is intended to serve as a
I have a fairly simple desktop application that uses a .NET setup project (.msi
I have a main activity that launches a child activity using the following code:
I have a personal Eclipse RCP product ( com.example.product ) based on one personal
I'm trying to figure out what is the best general design for applications that
First of all I am a programmer (Python, C, Java, Delphi, whatever) and not
This is my fist stackoverflow post so please be gentle with me! I'm sure
I'm relatively new in Android's world and the UI/Thread model is still confusing. Here

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.