Code example for View

Methods: getId

0
        mSessionText = sessionText;
    } 
 
 
    public void onClick(View v) {
        if (v.getId() == mPlayPauseButtonId) {
            playOrPause(); 
        } else if (v.getId() == mStopButtonId) {
            stop(); 
        } 
    } 
 
    public void playOrPause() { 
        if (mMediaPlayer == null || !mMediaPlayer.isPlaying()){
              if (mMediaPlayer == null) {
                  try { 
                      mMediaPlayer = new MediaPlayer();
                      if (mSession != 0) {
                          mMediaPlayer.setAudioSessionId(mSession);
                          Log.d(TAG, "mMediaPlayer.setAudioSessionId(): "+ mSession);
                      }