title: android.os.NetworkOnMainThreadException using rxjava on android
body: <p>i'm having trouble implementing rxJava in order to check if there is internet connection on android i'm doing it like this:</p>
  
  <p>on my launcher activity i have this in onCreate:</p>
  
  <pre><code>AndroidObservable.bindActivity(this,
              Observable.just(Utils.isActiveInternetConnection(Launcher.this)))
              .subscribeOn(Schedulers.newThread())
              .subscribe(new Action1&lt;Boolean&gt;() {
                  @Override
                  public void call(Boolean aBoolean) {
                      if (aBoolean) {
                          Toast.makeText(Launcher.this, "There is internet connection", Toast.LENGTH_SHORT).show();
                      } else {
                          Toast.makeText(Launcher.this, "There is no internet connection", Toast.LENGTH_SHORT).show();
                      }
                  }
              });
  </code></pre>
  
  <p>i have an Utils class it is a final class with static methods the methods in that the observable is using are this ones:</p>
  
  <pre><code>    public static boolean isActiveInternetConnection(Context context) {
      if (isNetworkAvailable(context)) {
          try {
              HttpURLConnection urlc = (HttpURLConnection) (new URL("http://www.google.com").openConnection());
              urlc.setRequestProperty("User-Agent", "Test");
              urlc.setRequestProperty("Connection", "close");
              urlc.setConnectTimeout(1500);
              urlc.connect();
              return (urlc.getResponseCode() == 200);
          } catch (IOException e) {
              Log.e("network", "Error checking internet connection", e);
          }
      } else {
          Log.d("network", "No network available!");
      }
      return false;
  }
  
  private static boolean isNetworkAvailable(Context context){
      ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
      NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
      if (null != activeNetwork) {
          return true;
      }
      else {
          return false;
      }
  }
  </code></pre>
  
  <p>i'm receiving android.os.NetworkOnMainThreadException and i can't find why, thanks in advance.</p>