I have a ProgressDialog which i started when Activity is Created(insideOnCreate method).
private void initDialog() {
mProgressDialog = new ProgressDialog(this);
mProgressDialog.setIndeterminate(true);
mProgressDialog.setTitle("Please wait.");
mProgressDialog.setMessage("Connecting to LinkedIn.");
mProgressDialog.setCancelable(false);
mProgressDialog.show();
}
After 2500ms i want to change a circle animation to my custom image(see below) (like an a simulation about when i finish retrieve some data from server and i'm done.) So i need to show user that process is finished. For this goal i select a next way.
- I show dialog
- When i retrieve data i change drawable of ProgressDialog
And this i have a problem. When i set the first time a drawable
private void initDialog() {
mProgressDialog = new ProgressDialog(this);
mProgressDialog.setIndeterminate(true);
mProgressDialog.setTitle("Please wait.");
mProgressDialog.setMessage("Connecting to LinkedIn.");
mProgressDialog.setCancelable(false);
//This
mProgressDialog.setIndeterminateDrawable(getResources().getDrawable(R.drawable.ok));
mProgressDialog.show();
}
ProgressDialog change drawable and all looks ok. But when ProgressBar launched(worked/circle animation playing) i try to reset a drawable
mProgressDialog.setIndeterminateDrawable(getResources().getDrawable(R.drawable.ok));
And i have unexpected result : circle animation disappear and no image set to current progress drawable. NO IMAGE! BLANK AREA instead of my image.
authButton.postDelayed(new Runnable() {
@Override
public void run() {
mProgressDialog.setIndeterminateDrawable(getResources().getDrawable(R.drawable.ok)); //doesn't work as expected!
}
}, 2500);