views:

109

answers:

1

I'm drawing a ProgressBar in a custom View (SurfaceView) to it's Canvas, and it's drawn as expected. Except that it's not animating, no matter what I do. My custom view is animated properly, but I cant change the progress of the ProgressBar.

I've created the ProgressBar like this:

mImageProgressbar = new ProgressBar(context);
mImageProgressbar.setIndeterminate(true);
int pad = 50;
mImageProgressbar.setPadding(pad, pad, pad, pad);
mImageProgressbar.layout(0, 0, 200, 200);
mImageProgressbar.setEnabled(true);

And I draw it something like this (slightly simplified):

Canvas c = mSurfaceHolder.lockCanvas(null);
mImageProgressbar.draw(c);

And I've tried updating it's progress manually as well:

mImageProgressbar.setProgress( (int)(System.currentTimeMillis()%1000) );

Any ideas on what I need to do in order for my ProgressBar to animate or change it's progress would be appreciated.

+1  A: 

Have you tried to invalidate the progressBar view?

mImageProgressbar.invalidate();

Text Tool
yes, didn't change anything.
Petrus