title: Check Whether Internet Connection is available or not?
body: <p>I am working on online app. [Problem] when internet is down or not available it gives me error [Force close], I tried to handle using broadCast Receiver but not meet exact solution, looking for better solution. </p>
  
  <pre><code>public class MyBroadcastReceiver extends BroadcastReceiver {
  
  @Override
  public void onReceive(final Context context, final Intent intent) {
  
      NetworkInfo info = intent
              .getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO);
  
      if (null != info) {
  
          String state = info.getState().toString();
  
          if (state.equalsIgnoreCase("CONNECTED")) {
              SplashScreen.isWiFiConnected = true;
              Log.i("isWifiConnected", "=================TRUE");
          } else {
              SplashScreen.isWiFiConnected = false;
              Log.i("isWifiConnected", "=================FALSE");
          }
  
      }
  
  }
  
  }
  </code></pre>
  
  <p>thanks.</p>