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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:38:14+00:00 2026-05-31T13:38:14+00:00

I have an android application which in its main activity, data are adapted from

  • 0

I have an android application which in its main activity, data are adapted from sqlite db and shown in list view. I tried to use Progress dialog to show ‘loading’ message to user during fetching data from db. But the dialog does not disappear.

Here is the code :

public class BirthdayAlarmActivity extends ListActivity {

    List<BirthdayContact> listofAvailableBirthdays;

    ProgressDialog pDialog;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.birthday_list);


        listofAvailableBirthdays=new ArrayList<BirthdayContact>();

        ReinitializeList();
}

@Override
protected void onResume() {

        ReinitializeList();
}


void ReinitializeList()
    {

        new LoadListView().execute();

            if(listofAvailableBirthdays.size()>0)
        {
            //get ready the adapter
            ArrayAdapter<BirthdayContact> ara=
                     new                 MyArrayAdapter(BirthdayAlarmActivity.this,listofAvailableBirthdays);

            //set the adapter
            setListAdapter(ara);
             }

}

public class LoadListView extends AsyncTask<Void, Void, Void>
{

        //ProgressDialog pDialog;

        @Override
        protected void onPreExecute() {
            // Showing progress dialog before sending http request
            pDialog = new ProgressDialog(
                    BirthdayAlarmActivity.this);
            pDialog.setMessage("Please wait..");
            pDialog.setIndeterminate(true);
            pDialog.setCancelable(false);
            pDialog.show();
        }

        protected Void doInBackground(Void... unused) {
            runOnUiThread(new Runnable() {
                public void run() {
                    // increment current page
                    listofAvailableBirthdays.clear();

                    listofAvailableBirthdays=BirthdayHandler.GetTenBirthDays(BirthdayAlarmActivity.this);
                }
            });
            return (null);
        }       

        protected void onPostExecute(Void unused) {
            // closing progress dialog
            pDialog.dismiss();
        }

    }
  • 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-31T13:38:15+00:00Added an answer on May 31, 2026 at 1:38 pm

    I’m not familiar with the technique you’re using, but I’ll share what works for me:

    final ProgressDialog progress = ProgressDialog.show(activity, "",
        activity.getString(R.string.please_wait), true);
    
    new Thread(new Runnable() {
      @Override
      public void run()
      {
        try {
          --- network activity to retrieve information ---
        }
        finally {
          activity.runOnUiThread(new Runnable() {
            @Override
            public void run()
            {
              if ((progress != null) && progress.isShowing())
                progress.dismiss();
            }
          });
        }
      }
    }).start();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need an Android application which should be able to fetch data from the
I have written a simple Android application that uses a sqlite database which is
I have two threads in an Android application, one is the view thread, and
I have an interesting problem being reported to me from an android application I
I have an android application using an SQLite database. I open the database when
I have developed an android application in which some OK button (soft key) is
I have made an application which calls the phone's contact list but i want
now I am doing an Android application.I have to read a file from sdcard.I
I am writing event based android application in which I start main thread which
Hi i have develop an android application in which i want to prevent user

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.