title: Broadcast onReciever calls multiple times and it giving Source not found exception
body: <p>When Wifi connection or Mobile data connection enabled I am notifying in my application.But my onReciever method calls multiple time and it's giving "Source not found exception".But in my logcat it's not printing any exceptions.While debuging time only I found that exception.In debuging time when onReciever method ends tat debuger returns "Source not found exception".</p>
  
  <pre><code>@Override
  public void onReceive(final Context context, final Intent intent) {
  
      System.out.println("Network change reciever started");      
      String status = NetworkUtil.getConnectivityStatusString(context);
      Toast.makeText(context, status, Toast.LENGTH_LONG).show();
  }
  </code></pre>
  
  <p>When onReciever calls my syso prints 4 times in logcat and toas cams 2,3 times.Why?</p>
  
  <p>What is the problem in my code?</p>
  
  <p>Manifest : </p>
  
  <pre><code>&lt;receiver
          android:name="com.electrical.coc.nz.automaticserversync.NetworkChangeReceiver"
          android:enabled="true"
          android:label="NetworkChangeReceiver" &gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.net.conn.CONNECTIVITY_CHANGE" /&gt;
              &lt;action android:name="android.net.wifi.WIFI_STATE_CHANGED" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
  </code></pre>
  
  <p>Update 1#</p>
  
  <pre><code>public class NetworkUtil {
  
  public static int TYPE_WIFI = 1;
  public static int TYPE_MOBILE = 2;
  public static int TYPE_NOT_CONNECTED = 0;
  
  public static int getConnectivityStatus(Context context) {
      ConnectivityManager cm = (ConnectivityManager) context
              .getSystemService(Context.CONNECTIVITY_SERVICE);
  
      NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
      if (null != activeNetwork) {
          if (activeNetwork.getType() == ConnectivityManager.TYPE_WIFI)
              return TYPE_WIFI;
  
          if (activeNetwork.getType() == ConnectivityManager.TYPE_MOBILE)
              return TYPE_MOBILE;
      }
      return TYPE_NOT_CONNECTED;
  }
  
  public static String getConnectivityStatusString(Context context) {
      int conn = NetworkUtil.getConnectivityStatus(context);
      String status = null;
      if (conn == NetworkUtil.TYPE_WIFI) {
          status = "Internet connection enabled";
      } else if (conn == NetworkUtil.TYPE_MOBILE) {
          status = "Internet connection enabled";
      } else if (conn == NetworkUtil.TYPE_NOT_CONNECTED) {
          status = "Internet connection disabled";
      }
      return status;
  }
  }
  </code></pre>