0
			Log.i(TAG, "MediaStreamerService.play() - AudioFocus request denied");
			 
			notifyStreamError(AUDIO_FOCUS_DENIED_ERROR);
		} 
		 
		mMediaPlayer = new MediaPlayer();
        mMediaPlayer.setOnErrorListener(this);
        mMediaPlayer.setOnPreparedListener(this);
         
        mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);  
        mMediaPlayer.setVolume(1.0f, 1.0f);
    	try { 
        	mMediaPlayer.setDataSource(this, Uri.parse(urlToStream));
		} catch (Exception e){
    		Log.e(TAG, "MediaStreamerService.play() - Error setting data source for the media player", e);
    		stop(); 
    		notifyStreamError(MEDIA_PLAYER_ERROR);
    		return; 
    	} 
    	try{ 
            mMediaPlayer.prepareAsync(); // prepare async to not block main thread
		} catch (Exception e){
    		Log.e(TAG, "MediaStreamerService.play() - Error preparing the media player", e);
    		stop(); 
    		notifyStreamError(MEDIA_PLAYER_ERROR);
    		return; 
Contextual code suggestions in your IDE  Get Codota for Java