public void setLivePreview(LivePreview livePreview) { if (myLivePreview != null) { myLivePreview.dispose(); myLivePreview.setDelegate(null); } myLivePreview = livePreview; if (myLivePreview != null) { myLivePreview.setDelegate(this); } }