I have created a small "widget" in my project by extending a ViewGroup. In that widget I want to add and remove buttons (ImageView's).
It was easy to create the widget and adding buttons worked fine but sometimes when I want to remove a button I added earlier it's still displayed on the screen even though the code has been accessed.
The widget is added through the layout xml and I add/removes buttons by calling on a function in the widget from my activity. To be more precise; my widget gets an onClickEvent and sends it to my activity who tells my widget to remove the button through removeView().
I have tried with invalidate() on both the widget and the button. I have also tried to set it to invisible, layout(0,0,0,0) and a few more but nothing is working. Anyone who got an idea what I'm doing wrong?
Edit: Answer in comment below