title: How to close app if there is no internet connection available
body: <p>This is my <code>SplashActivity</code> and what I have to do to quit my app if there is no internet connection I want to check both the wifi and mobile data and display a toast message and quit? </p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_splash);
  
      this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
      Handler handler = new Handler();
      handler.postDelayed(new Runnable() {
          @Override
          public void run() {
              Intent intent = new Intent(SplashActivity.this, MainActivity.class);
              startActivity(intent);
              finish();
  
          }
      },3500);
  
  }
  
  }
  </code></pre>