title: Calling check internet connectivity class when clicking a button from another activity
body: <p>What i have is an android application , i have an activity which check if internet connectivity exist or not and here it is :</p>
  
  <pre><code>public class MainActivity extends Activity {
  
      private static final String LOG_TAG = "CheckNetworkStatus";
       private NetworkChangeReceiver receiver;
       private boolean isConnected = false;
       private TextView networkStatus;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
            receiver = new NetworkChangeReceiver();
            registerReceiver(receiver, filter);
  
            networkStatus = (TextView) findViewById(R.id.networkStatus);
           }
  
  
           @Override
           protected void onDestroy() {
            Log.v(LOG_TAG, "onDestory");
            super.onDestroy();
  
            unregisterReceiver(receiver);
  
           }
  
  
           public class NetworkChangeReceiver extends BroadcastReceiver {
  
            @Override
            public void onReceive(final Context context, final Intent intent) {
  
             Log.v(LOG_TAG, "Receieved notification about network status");
             isNetworkAvailable(context);
  
            }
  
  
            private boolean isNetworkAvailable(Context context) {
             ConnectivityManager connectivity = (ConnectivityManager)
               context.getSystemService(Context.CONNECTIVITY_SERVICE);
             if (connectivity != null) {
              NetworkInfo[] info = connectivity.getAllNetworkInfo();
              if (info != null) {
               for (int i = 0; i &lt; info.length; i++) {
                if (info[i].getState() == NetworkInfo.State.CONNECTED) {
                 if(!isConnected){
                  Log.v(LOG_TAG, "Now you are connected to Internet!");
                  networkStatus.setText("Now you are connected to Internet!");
                  isConnected = true;
                  //do your processing here ---
                  //if you need to post any data to the server or get status
                  //update from the server
                 }
                 return true;
                }
               }
              }
             }
             Log.v(LOG_TAG, "You are not connected to Internet!");
             networkStatus.setText("You are not connected to Internet!");
             isConnected = false;
             return false;
            }
           }
  
  
          }
  </code></pre>
  
  <p>And i have another Activity which has a button , and i want when i click the button to check if internet connectivity exist it will make a toast in this activity without opening the internet activity , here is my button :</p>
  
  <pre><code>  Submit.setOnClickListener(new OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  // TODO Auto-generated method stub
  
              }
          });
  </code></pre>
  
  <p>How can i make the other Activity work start on a click without make it visible on the application? 
  Am new At android .. please help :(</p>