Disable button when there is no internet connection
<p>My code looks like this:</p>

<pre><code>    mediaPlayer = new MediaPlayer();
    mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);

    new PlayerTask().execute(stream);

    b_play.setOnClickListener(new View.OnClickListener() {

     @Override
     public void onClick(View view) {
         if (started) {
             started = false;
             mediaPlayer.pause();
             b_play.setText(R.string.start);
         } else {
             started = true;
             mediaPlayer.start();
             b_play.setText(R.string.pause);

         }
     }
});
</code></pre>

<p>How can I disable b_play button when there is no internet connection?</p>