title: How to show one toast at a time in onreceive() of broadcast receiver not all at once
body: <p>I got a strange problem on restricting toast messages in OnReceive() of broadcast receiver</p>
  
  <p>I have written code for displaying toast when wifi and bluetooth are enabled/disabled</p>
  
  <p>but If  I enable/disable wifi, toast for bluetooth also appearing and viceversa i.e all 4 toast messages appearing one by one when I enable/disable bluetooth and wifi</p>
  
  <p>What I want to do is I want to show one toast when wifi is off/on and also for bluetooth individually </p>
  
  <p>like</p>
  
  <pre><code> if WIFI is on  -  "wifi enabled"
   if WIFI is off -   "wifi disabled"
  If bluetooth is on - "Bluetooth enabled"
  If bluetooth is off - "Bluetooth disabled"
  </code></pre>
  
  <p>Only one toast at a time not all</p>
  
  <p>How to get around this problem?</p>
  
  <p>Here is my code</p>
  
  <pre><code>  public class MyService extends BroadcastReceiver {
  private WifiManager wifiManager;
  @Override
  public void onReceive(Context context, Intent arg1) {
      // TODO Auto-generated method stub
  
      wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
        BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
  
      if(wifiManager.isWifiEnabled()){  
          Toast.makeText(context.getApplicationContext(), "WIFI  Enabled", Toast.LENGTH_LONG).show();
      }else {    
          Toast.makeText(context.getApplicationContext(), "WIFI Disabled", Toast.LENGTH_LONG).show();
      }  
      if(adapter.isEnabled()){
  
          Toast.makeText(context.getApplicationContext(), "Bluetooth Enabled", Toast.LENGTH_LONG).show();
  
      }else {    
          Toast.makeText(context.getApplicationContext(), " Bluetooth Disabled", Toast.LENGTH_LONG).show();
      }
  }
  </code></pre>