i have :
The specified child already has a parent. You must call removeView()
on the child's parent first
The former may not remove all the views, the latter will remove all the views. Unless you are doing your own logic to figure which views were removed in
removeAllViewsInLayout(), you are likely trying to add duplicate views to your layout.
As a matter of fact,
removeAllViewsInLayout() comes with this warning:
Do not call this method unless you are extending ViewGroup and understand the view measuring and layout pipeline.
Based on your post, I am assuming that you are not extending ViewGroup and properly analyzing the measuring/layout pipeline, and thus should not be calling that method.
mContainer is not actual parent of
mContainer will not suffice. In that case you have to remove
removeView() method on it's real parent before you can add it to