SyntaxFix
Write A Post
Hire A Developer
Questions
You can also do it by checking if View's indexOfView method if indexOfView method returns -1 then we can use.
ViewGroup's detachViewFromParent(v); followed by ViewGroup's removeDetachedView(v, true/false);