Code example for MediaPlayer.OnErrorListener

Methods: onError

            /* If an error handler has been supplied, use it and finish. */ 
            if (mOnErrorListener != null) { 
                if (mOnErrorListener.onError(mMediaPlayer, framework_err, impl_err)) { 
                    return true; 
            /* Otherwise, pop up an error dialog so the user knows that 
             * something bad has happened. Only try and pop up the dialog 
             * if we're attached to a window. When we're going away and no 
             * longer have a window, don't bother showing the user an error. 
            if (getWindowToken() != null) { 
                Resources r = mContext.getResources(); 
                int messageId;