I have a problem with a custom button. onDraw() gets called again and again, and I can\'t figure out why.
public class CircleButton extends Button {
static
Change the drawableStateChanged()
method:
invalidate
super.drawableStateChanged()
.Sorry, dumb failure:
this.getDefaultBitmap()
had a setBackgroundColor(0x00000000)
;
call in it which retriggered the onDraw.
So kind of a recursion:
onDraw()
-> getDefaultBitmap()
-> setBackgroundColor()
-> onDraw