Skip to content

Commit

Permalink
Fix for “The specified child already has a parent”
Browse files Browse the repository at this point in the history
  • Loading branch information
shanereid committed Oct 11, 2018
1 parent a45f7a7 commit eb295df
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,13 @@ public void addFeature(View child, int index) {
int visibility = annotation.getVisibility();
annotation.setVisibility(INVISIBLE);

// Remove from a view group if already present, prevent "specified child
// already had a parent" error.
ViewGroup annotationParent = (ViewGroup)annotation.getParent();
if (annotationParent != null) {
annotationParent.removeView(annotation);
}

// Add to the parent group
attacherGroup.addView(annotation);

Expand Down

0 comments on commit eb295df

Please sign in to comment.