List of usage examples for android.media MediaPlayer pause
public void pause() throws IllegalStateException
From source file:com.aujur.ebookreader.activity.ReadingFragment.java
public void onMediaButtonEvent(int buttonId) { if (buttonId == R.id.playPauseButton && !ttsIsRunning()) { startTextToSpeech();//from ww w . j a va 2 s .c om return; } TTSPlaybackItem item = this.ttsPlaybackItemQueue.peek(); if (item == null) { stopTextToSpeech(false); return; } MediaPlayer mediaPlayer = item.getMediaPlayer(); uiHandler.removeCallbacks(progressBarUpdater); switch (buttonId) { case R.id.stopButton: stopTextToSpeech(true); return; case R.id.nextButton: performSkip(true); uiHandler.post(progressBarUpdater); return; case R.id.prevButton: performSkip(false); uiHandler.post(progressBarUpdater); return; case R.id.playPauseButton: if (mediaPlayer.isPlaying()) { mediaPlayer.pause(); } else { mediaPlayer.start(); uiHandler.post(progressBarUpdater); } return; } }