title: Why does VOLUME_CHANGED_ACTION get fired multiple times for same state for one call?
body: <p>VOLUME_CHANGED_ACTION get fired multiple times for same state when i press volume down or up button.</p>
  
  <p>add in androidmanifest.xml:</p>
  
  <pre><code>&lt;receiver android:name=".VolumeSateReceiver"&gt;
             &lt;intent-filter&gt;
                       &lt;actionandroid:name="android.media.VOLUME_CHANGED_ACTION" /&gt;
             &lt;/intent-filter&gt;
         &lt;/receiver&gt;
  </code></pre>
  
  <p>in VolumeSateReceiver.java:</p>
  
  <pre><code>public class VolumeSateReceiver extends BroadcastReceiver {
  
      Context pcontext;
  
      @Override
      public void onReceive(Context context, Intent intent) {
          pcontext = context;
          //check the intent something like:
          if (intent.getAction().equals("android.media.VOLUME_CHANGED_ACTION")) {
              int newVolume = intent.getIntExtra("android.media.EXTRA_VOLUME_STREAM_VALUE", 0);
              int oldVolume = intent.getIntExtra("android.media.EXTRA_PREV_VOLUME_STREAM_VALUE", 0);
  
                 if (newVolume != oldVolume) {
                     //Toast.makeText(pcontext ,"newVolume" +newVolume + " oldVolume" + oldVolume, Toast.LENGTH_SHORT).show();
                     System.out.println("In onReceive" + "newVolume" +newVolume + " oldVolume" + oldVolume );
  
              }
          }
      }
  }
  </code></pre>