how to show progress bar(circle) in an activity having a listview before loading the listview with data

后端 未结 12 2426
忘掉有多难
忘掉有多难 2020-11-28 00:18

I have a ListView in my second activity.OnItemClick of it I called a webservice and trying to fetch data. And after that I am moving to third activ

12条回答
  •  遥遥无期
    2020-11-28 00:54

    Use This Within button on Click option or your needs:

    final ProgressDialog progressDialog;
    progressDialog = new ProgressDialog(getApplicationContext());
    progressDialog.setMessage("Loading..."); // Setting Message
    progressDialog.setTitle("ProgressDialog"); // Setting Title
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); // Progress Dialog Style Spinner
    progressDialog.show(); // Display Progress Dialog
    progressDialog.setCancelable(false);
    new Thread(new Runnable() {
        public void run() {
            try {
                Thread.sleep(5000);
            } catch (Exception e) {
                e.printStackTrace();
            }
            progressDialog.dismiss();
        }
    }).start();
    

提交回复
热议问题