title: Access a variable from another class when using broadcast receiver
body: <p>I am using broadcast receiver for get network status.I am using this code</p>
  
  <pre><code>public class ConnectionChangeReceiver extends BroadcastReceiver
  {
  
    public Boolean networkStatus=false;
  
    @Override
    public void onReceive( Context context, Intent intent )
    {
      ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService( Context.CONNECTIVITY_SERVICE );
      NetworkInfo activeNetInfo = connectivityManager.getActiveNetworkInfo();
      NetworkInfo mobNetInfo = connectivityManager.getNetworkInfo(     ConnectivityManager.TYPE_MOBILE );
      Log.w("Network Status:",""+activeNetInfo);
      if ( activeNetInfo != null )
      {
        networkStatus=true;
        Toast.makeText( context, "Active Network Type : " + activeNetInfo.getTypeName(), Toast.LENGTH_SHORT ).show();
      }
      if( mobNetInfo != null )
      {
        networkStatus=true;
        Toast.makeText( context, "Mobile Network Type : " + mobNetInfo.getTypeName(), Toast.LENGTH_SHORT ).show();
      }
    }
  </code></pre>
  
  <p>But you know this is a another class and I have to access <code>networkStatus</code> variable from main activity class.How can I do this ?</p>