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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:54:32+00:00 2026-05-27T15:54:32+00:00

I have a ListActivity that requires a lot of data to be processed via

  • 0

I have a ListActivity that requires a lot of data to be processed via a Thread. I want to show a Dialog while the work is being done in the background. However, the Dialog doesn’t show until the view is done loading. I use this approach on a regular activity and it works(Dialog pops up, worker starts, worker finishes, Dialog dismisses). When the work is done, a message is sent the handler to load the view and dismiss the Dialog.

Here is my code:

@Override
public void onCreate(Bundle icicle) {

    super.onCreate(icicle); 
    initViewProperties();
    dialogCode = 0;
    showDialog(dialogCode);

}

@Override
protected Dialog onCreateDialog(int id) {

    int resID = getResources().getIdentifier(getCfrFile(), "raw", getPackageName());        
    progDialog = new ProgressDialog(this);

    switch (dialogCode) {
        case 0:
            progDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);  
            progDialog.setMessage(getCurrentTitle());
            break;
        case 1:
            progDialog.setMessage("Loading CFR");
            break;

        default:
            break;
    }       

    try {
        // do the work here
        xmlListRowFactoryHelper = new AcmListViewFactoryHelper(handler, resID, this, xpathBuilder(false), "title") ;
        xmlListRowFactoryHelper.run();

    } catch (Exception e) {

        e.printStackTrace();
    }

    return progDialog;

}   

final Handler handler = new Handler() {
    @Override
    public void handleMessage(Message msg) {

        int total = msg.getData().getInt("total");            

        progDialog.setProgress(total);

        if (total <= 0){

            xmlListRowFactoryHelper.setState(AcmTableRowFactoryHelper.DONE);
            // load the view here
            loadListView();    
        }
    }
}
  • 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-27T15:54:33+00:00Added an answer on May 27, 2026 at 3:54 pm

    use Asyntask concept which remove complex threading concept http://developer.android.com/reference/android/os/AsyncTask.html

    example http://www.vogella.de/articles/AndroidPerformance/article.html

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

Sidebar

Related Questions

I have two ListActivity classes that I want to pass into into a third
I have a ListActivity that should display quite a lot of items and where
I have an android ListActivity that creates multiple buttons (from a database source) via
I have a ListActivity which I want to show when the phone's orientation is
I have a ListActivity that uses a CursorAdapter to display some data. This data
I have a ListView in a ListActivity that's bound to some data. I have
I have a ListActivity that's populated with a SimpleCursorAdapter which pulls the data from
I have a basic ListActivity that supports context menus via onCreateContextMenu() and onContextItemSelected(). If
I have several methods in the ListAC ListActivity that I want to reuse and
I have a ListActivity extended class in that i want to display the names

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.