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

  • Home
  • SEARCH
  • 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 8114675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:12:58+00:00 2026-06-06T03:12:58+00:00

The issue: Simply put, my Progress dialog continuously says downloading data rather than opening

  • 0

The issue:

Simply put, my Progress dialog continuously says “downloading data” rather than opening up the ListView populated from the MySQL database I am connecting to (through php).

Here is my code:

 public class Main extends ListActivity {

JSONArray jArray;
String result = null;
InputStream is = null;
StringBuilder sb = null;
List<String> cats = null;

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

    cats = new ArrayList<String>();
    new task().execute();

    setListAdapter(new ArrayAdapter<String>(this, R.layout.list, cats));

    ListView listView = getListView();
    listView.setTextFilterEnabled(true);

    listView.setOnItemClickListener(new OnItemClickListener() {

        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
                long id) {


            int cat_id = ((int) id);
            Intent itemIntent = new Intent(getApplicationContext(), Items.class);
            Bundle d = new Bundle();
            cat_id = cat_id +1;
            d.putString("category_id", String.valueOf(cat_id));

            itemIntent.putExtras(d);
            startActivity(itemIntent);

        }
    });




}

class task extends AsyncTask<String, String, Void> {
    private ProgressDialog progressDialog = new ProgressDialog(Main.this);
    InputStream is = null;
    String result = "";

    protected void onPreExecute() {
        progressDialog.setMessage("Download data...");
        progressDialog.show();
        progressDialog.setOnCancelListener(new OnCancelListener() {

            public void onCancel(DialogInterface dialog) {
                task.this.cancel(true);

            }
        });
    }

    @Override
    protected Void doInBackground(String... params) {
        String url_select = "http://www.--.com/---/master.php";

        HttpClient httpClient = new DefaultHttpClient();
        HttpPost httpPost = new HttpPost(url_select);

        ArrayList<NameValuePair> param = new ArrayList<NameValuePair>();

        try {
            httpPost.setEntity(new UrlEncodedFormEntity(param));

            HttpResponse httpResponse = httpClient.execute(httpPost);
            HttpEntity httpEntity = httpResponse.getEntity();

            // read content
            is = httpEntity.getContent();

        } catch (Exception e) {

            Log.e("log_tag", "Error in http connection " + e.toString());
        }
        try {
            BufferedReader br = new BufferedReader(
                    new InputStreamReader(is));
            StringBuilder sb = new StringBuilder();
            String line = "";
            while ((line = br.readLine()) != null) {
                sb.append(line + "\n");
            }
            is.close();
            result = sb.toString();

        } catch (Exception e) {
            // TODO: handle exception
            Log.e("log_tag", "Error converting result " + e.toString());
        }

        return null;

    }

    protected void onPostExecute(Void v) {



        String cat;
        try {
            jArray = new JSONArray(result);
            JSONObject json_data = null;
            for (int i = 0; i < jArray.length(); i++) {
                json_data = jArray.getJSONObject(i);
                cat = json_data.getString("category");

                cats.add(cat);

            }
        } catch (JSONException e1) {
            Toast.makeText(getBaseContext(), "No Categories Found",
                    Toast.LENGTH_LONG).show();
        } catch (ParseException e1) {
            e1.printStackTrace();
        }

    }
}

}

  • 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-06T03:13:00+00:00Added an answer on June 6, 2026 at 3:13 am

    You should dismiss the progress dialog in your onPostExecute() method..
    Eg.: progressDialog.dismiss();

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

Sidebar

Related Questions

I'm experiencing the problem described in this Android issue: http://code.google.com/p/android/issues/detail?id=4536 Simply put, after pressing
I have an issue with grabbing an image dynamicly. Simply put, how can I
Simply put this program is merging two arrays containing coordinates into one larger array,
Simply put, I am making a flash midi player. I am using ENTER_FRAME for
Simply put, I'd like someone to be able to click a link, and get
This may well be a server config issue; or simply a blindly obvious reason
I an issue that has me completely stumped. I am simply running a simple
Fairly simple issue which is solved in PHP by using a static variable. private
My issue is simple really, I just don't know how to fix it. I
I have simple issue setting a two-way databinding of a checkbox in Silverlight 3.0.

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.