how can really show ProgressDialog while waiting f

2020-04-11 06:39发布

问题:

I want to show ProgressDialog but ProgressDialog never really rendered ! And I want to end this process to start next state. this is my code:

ProgressDialog waitProgressDialog = new ProgressDialog(getContext());
            waitProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            waitProgressDialog.setMessage("please wait..");
            waitProgressDialog.setOnShowListener(new OnShowListener() {

                @Override
                public void onShow(DialogInterface dialog) {
                    ExirDebugger.println("----------TEST999999 START");
///same sqlit datasouce select
                    ExirDebugger.println("----------TEST999999 END");
                }
            });
            waitProgressDialog.show();

android not render anything while all work end! can anyone help me?

回答1:

I use

ProgressDialog dialog = ProgressDialog.show(className.this, "", "Loading. Please wait...", true);

 //Do stuff

dialog.dismiss();