Code example for MediaPlayer.OnErrorListener

Methods: onError

0
            attachMediaController(); 
        } catch (IOException ex) {
            Log.w(TAG, "Unable to open content: " + mUri, ex);
            mCurrentState = STATE_ERROR;
            mTargetState = STATE_ERROR;
            mErrorListener.onError(mMediaPlayer, MediaPlayer.MEDIA_ERROR_UNKNOWN, 0);
            return; 
        } catch (IllegalArgumentException ex) {
            Log.w(TAG, "Unable to open content: " + mUri, ex);
            mCurrentState = STATE_ERROR;
            mTargetState = STATE_ERROR;
            mErrorListener.onError(mMediaPlayer, MediaPlayer.MEDIA_ERROR_UNKNOWN, 0);
            return; 
        } 
    } 
 
    public void setMediaController(MediaController controller) {
        if (mMediaController != null) {
            mMediaController.hide();
        } 
Stop searching for code, let great code find you!  Add Codota to your java IDE