I have a ProgressDialog that I started when I created an Activity (inside the inOnCreate 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 2500 ms, I want to change the circle animation to my custom image (see below) (for example, a simulation of when I finish receiving some data from the server, and I finished.) So, I need to show the user that the process is complete. For this purpose, I choose the following path.
- I am showing a dialogue
- When I retrieve the data, I change the drawable of ProgressDialog
And I have a problem. When I install the first time
private void initDialog() { mProgressDialog = new ProgressDialog(this); mProgressDialog.setIndeterminate(true); mProgressDialog.setTitle("Please wait."); mProgressDialog.setMessage("Connecting to LinkedIn."); mProgressDialog.setCancelable(false);
ProgressDialog changes and everything looks fine. But when the ProgressBar starts up (circle animation works / works), I try to reset to draw
mProgressDialog.setIndeterminateDrawable(getResources().getDrawable(R.drawable.ok));
And I have an unexpected result: the circle animation disappears, and the image is not set to the current progress. NO PICTURES! BLANK AREA instead of my image.
authButton.postDelayed(new Runnable() { @Override public void run() { mProgressDialog.setIndeterminateDrawable(getResources().getDrawable(R.drawable.ok));
So my question is: how can I change the availability at runtime while the ProgressDialog is running?
need to change to 
source share