문제

i'm using a AsyncTask ProgressDialog to display some message. While processing it has an image instead of the spinning circle. I have set this in onPreExecute as :-

Drawable myIconStart = getResources().getDrawable(R.drawable.imagestart);
this.dialog.setIndeterminate(true);
this.dialog.setIndeterminateDrawable(myIconStart); 
this.dialog.setMessage("Processing… please wait for confirmation");

Now when the work is done, in onPostExecute , i'm setting as:-

Drawable myIconDone = getResources().getDrawable(R.drawable.imagedone);
            this.dialog.setIndeterminate(true);
            this.dialog.setIndeterminateDrawable(myIconDone);
            this.dialog.setMessage("Your Reservation has been confirmed");

But, the second image at onPostExecute is not being set. The First Image appears and then disappears, the second image appears as blank. Could you please tell me what i'm doing wrong/what i'm supposed to do?

도움이 되었습니까?

해결책

Seems like the indeterminate drawable cannot really be replaced.

For your requirement, consider writing a custom dialog with a layout consisting of a ProgressBar, an ImageView for the done icon and a TextView for the message. Switch the visibility of the icon and progress bar when changing state.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top