views:

190

answers:

1

Hi

I'm developing an Android app.

I have class derived from button to represent a special type of button. This special type has some properties (integers) and according to these one or more circles have to be drawn on top of the button.

So I overrode the onDraw function, which looks the values up and accordingly draws the circles.

But the class has a function to set new values for its properties. So new values are set but the changes are not reflected in the UI. It seems like the onDraw function is not called.

When later I click the button or show a pop up message above my interface the onDraw function is called and the button is drawn correctly.

So my question: when changing the properties how can I say that the button has to be redrawn?

Thanks a lot!

+1  A: 

Call invalidate() on the button to have it (or part of it) redrawn.

CommonsWare