List of usage examples for android.view SurfaceView getViewTreeObserver
public ViewTreeObserver getViewTreeObserver()
From source file:github.nisrulz.qreader.QREader.java
public void initAndStart(final SurfaceView surfaceView) { surfaceView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override/*from w ww. ja v a 2s . com*/ public void onGlobalLayout() { init(); start(); removeOnGlobalLayoutListener(surfaceView, this); } }); }