I want to remove a Button in his own onClick method after it’s clicked. I tried it with the normal way:
layout.removeView(save);
But the button will not be removed and I get no error. If I want to add the Button I get an error because the button already excists.
I think it isn’t working because I trie to remove the button during his OnClickHandler is active. So my Question is how can I remove the button after he is clicked?
Here’s the complete, fully tested solution:
You can also completely remove the view from the layout like this (also tested):