Code example for Fragment

Methods: getActivity, checkState

   * Creates the controller (play, pause, rewind etc controls) for the player. 
  private void createMediaController() { 
    checkState(mediaPlayer != null,
        "media player must be initialized before the media controller"); 
    mediaController = new MediaController(getActivity());
    MediaPlayerControl mediaPlayerControl = new MediaController.MediaPlayerControl() {
      public boolean canPause() { 
        return true; 
      public boolean canSeekBackward() { 
Experience pair programming with AI  Get Codota for Java