I have used progressDialog in my android application and i have used code as
ProgressDialog progressDialog = new ProgressDialog(this);
progressDialog.se
Make custom progress dialog like below:
custom_progress_dialog.xml
MyCustomProgressDialog.java
public class MyCustomProgressDialog extends ProgressDialog {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.custom_progress_dialog);
...
}
public static MyCustomProgressDialog ctor(Context context) {
MyCustomProgressDialog dialog = new MyCustomProgressDialog(context);
dialog.setIndeterminate(true);
dialog.setCancelable(false);
return dialog;
}
@Override
public void show() {
super.show();
}
@Override
public void dismiss() {
super.dismiss();
}
}
and then use progress dialog class in asynctask like below:
class DemoAsyncTask extends AsyncTask {
private final MyCustomProgressDialog progressDialog;
public DemoAsyncTask(Context ctx) {
progressDialog = MyCustomProgressDialog.ctor(ctx);
}
@Override
protected void onPreExecute() {
super.onPreExecute();
textView.setVisibility(View.INVISIBLE);
progressDialog.show();
}