title: Apply and Clear ColorFilter on view in Android
body: <p>I have 2 buttons with different parents.</p>
  
  <p>I am trying to apply button effect onTouch of the button.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>public class ButtonHighlighterOnTouchListener implements OnTouchListener {
  
      final Button button;
  
      public ButtonHighlighterOnTouchListener(final Button imageButton) {
        super();
        this.button = imageButton;
      }
  
      public boolean onTouch(final View view, final MotionEvent event) {
          switch (event.getAction()) {
          case MotionEvent.ACTION_DOWN:
              button.getBackground().setColorFilter(Color.parseColor("#B7B2B0"), PorterDuff.Mode.MULTIPLY);
              button.invalidate();
              break;
          case MotionEvent.ACTION_CANCEL:
              button.getBackground().clearColorFilter();
              button.invalidate();
              break;
          case MotionEvent.ACTION_UP:
              button.getBackground().clearColorFilter();
              button.invalidate();
              break;
          }
          return false;
          }
  }
  </code></pre>
  
  <p>It applies the effect to the button, but the problem is since I have 2 buttons, even when I click on one button, the effect is being applied to the other button as well.</p>
  
  <p>Please help me to fix this.</p>