views:

249

answers:

2

I am having problem with setting a new Drawable to my ProgressBar.

If I use the setProgressDrawable() inside onCreate() method it works great. But when I try to call the same method inside a Handler post callback it doesn't work and the progressbar disapears.

Can someone explain this behaviour? How can I solve this problem?

A: 

Hi Martin,

Maybe you put the code in a thread which is not main thread. If you want to work with the UI, you must do that in the main thread :)

Bino
It is in a thread. But I use Handler.post(new Runnable() so the operation will be handled by the UI thread. It is working great to update progressbar value. (but not to change the drawable)
Martin
Just my experience, if some view in activity like dialogs (maybe ProgressBar the same) are displayed once, you can not change them any more.Like: you create a AlertDialog in the onCreateDialog method that does not contain a message. Then, in the onPrepareDialog method, you set the message --> the message will not be display. Sth like cache, as I remember.
Bino
A: 

I'm sorry I don't have an answer, this is just another plea for someone to provide the answer. In reference to "gosh, that's unusual, why would you want change the background drawable", the application is a color picker using HSV (Hue, Saturation, Value). Once the user selects a Hue (via SeekBar1), we want to show the impact of using SeekBar2 and SeekBar3 to select the Saturation and Value.

This seems like a VERY mainstream application to me. Can Android seriously not handle this??

-CH

Chuck