Code example for MediaPlayer.OnCompletionListener

Methods: onCompletion

0
            mTargetState = STATE_PLAYBACK_COMPLETED; 
            if (mMediaController != null) { 
                mMediaController.hide(); 
            } 
            if (mOnCompletionListener != null) { 
                mOnCompletionListener.onCompletion(mMediaPlayer); 
            } 
        } 
    }; 
 
    private MediaPlayer.OnErrorListener mErrorListener =
        new MediaPlayer.OnErrorListener() { 
        public boolean onError(MediaPlayer mp, int framework_err, int impl_err) { 
            Log.d(TAG, "Error: " + framework_err + "," + impl_err); 
            mCurrentState = STATE_ERROR; 
            mTargetState = STATE_ERROR; 
            if (mMediaController != null) { 
                mMediaController.hide(); 
            } 
 
            /* If an error handler has been supplied, use it and finish. */