@Test public void setSurfaceViewCallbackAfterCreate() { SingleFragmentTestActivity activity = launchAndWaitActivity(VideoFragment.class, 1000); VideoFragment fragment = (VideoFragment) activity.getTestFragment(); assertNotNull(fragment); final boolean[] surfaceCreated = new boolean[1]; fragment.setSurfaceHolderCallback(new SurfaceHolder.Callback() { @Override public void surfaceCreated(SurfaceHolder holder) { surfaceCreated[0] = true; } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { } @Override public void surfaceDestroyed(SurfaceHolder holder) { surfaceCreated[0] = false; } }); assertTrue(surfaceCreated[0]); }
public void setSurfaceHolderCallback(SurfaceHolder.Callback callback) { mMediaPlaybackCallback = callback; if (callback != null) { if (mState == SURFACE_CREATED) { mMediaPlaybackCallback.surfaceCreated(mVideoSurface.getHolder()); } } }
VideoFragment extends PlaybackFragment { public void setSurfaceHolderCallback(SurfaceHolder.Callback callback) { mMediaPlaybackCallback = callback; if (callback != null) { if (mState == SURFACE_CREATED) { mMediaPlaybackCallback.surfaceCreated(mVideoSurface.getHolder()); } } } }
VideoFragment extends PlaybackFragment { public void setSurfaceHolderCallback(SurfaceHolder.Callback callback) { mMediaPlaybackCallback = callback; if (callback != null) { if (mState == SURFACE_CREATED) { mMediaPlaybackCallback.surfaceCreated(mVideoSurface.getHolder()); } } }  }
VideoFragment extends PlaybackFragment { public void setSurfaceHolderCallback(SurfaceHolder.Callback callback) { mMediaPlaybackCallback = callback; if (callback != null) { if (mState == SURFACE_CREATED) { mMediaPlaybackCallback.surfaceCreated(mVideoSurface.getHolder()); } } }  @Override View onCreateView(
            LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState); void setSurfaceHolderCallback(SurfaceHolder.Callback callback); SurfaceView getSurfaceView(); @Override void onDestroyView(); }
VideoFragment extends PlaybackFragment { public void setSurfaceHolderCallback(SurfaceHolder.Callback callback) { mMediaPlaybackCallback = callback; if (callback != null) { if (mState == SURFACE_CREATED) { mMediaPlaybackCallback.surfaceCreated(mVideoSurface.getHolder()); } } }  @Override View onCreateView(
            LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState); void setSurfaceHolderCallback(SurfaceHolder.Callback callback); SurfaceView getSurfaceView(); @Override void onDestroyView();  }