Skip to content

Commit

Permalink
Merge pull request #5292 from salachi/TIMOB-16166
Browse files Browse the repository at this point in the history
TIMOB-16166-Detach the view from the existing parent before adding
  • Loading branch information
hieupham007 committed Jan 30, 2014
2 parents f863a8f + 1cf8b6c commit 7f35532
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.FrameLayout;

Expand Down Expand Up @@ -204,8 +206,13 @@ protected void onResume()
cameraActivity = this;
previewLayout.addView(preview, new FrameLayout.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
cameraLayout.addView(localOverlayProxy.getOrCreateView()
.getNativeView(), new FrameLayout.LayoutParams(
View overlayView = localOverlayProxy.getOrCreateView().getNativeView();
ViewGroup parent = (ViewGroup) overlayView.getParent();
// Detach from the parent if applicable
if (parent != null) {
parent.removeView(overlayView);
}
cameraLayout.addView(overlayView, new FrameLayout.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
}

Expand Down

0 comments on commit 7f35532

Please sign in to comment.