title: How to catch an Exception if the Internet or Signal is down
body: <p>i am working with mediaplayer and streaming audio and i am wondering what is the best way to catch an excpetion if the internet or signal is down and can not stream anymore audio.</p>
  
  <p>below is my code that i have done so far, as you can see i am throwing all the excpetion with same message.</p>
  
  <pre><code>private class taskDoSomething extends AsyncTask&lt;Void, Void, List&lt;Employee&gt;&gt; 
  { 
  
      @Override 
      protected List&lt;Employee&gt; doInBackground(Void... params) 
      { 
      String url = "http://ofertaweb.ro/android/sleepandlovemusic/list_files.php";
  
      try {
          Get_Webpage obj = new Get_Webpage(url);
          directory_listings = obj.get_webpage_source();
      } catch (Exception e) {
           Toast.makeText(this, "You have to be connected to the internet for this application to work", Toast.LENGTH_LONG).show();
         finish();
      }
  }
  </code></pre>