title: Touch listener not working android
body: <p>I have a problem with touch listener in my android application. OnTouchLIstenr is not working for the view, i.e ACTION_DOWN is performing well in the listener but ACTION_UP doesnt invokes. i dont know whats the problem going on. But if i set the dummy click listener, both working fine. Why is it so?</p>
  
  <pre><code>@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      ImageView image = (ImageView) findViewById(R.id.image);
      image.setOnTouchListener(new OnTouchListener() {            
          @Override
          public boolean onTouch(View v, MotionEvent event) {
              ImageView img = (ImageView) v;
              int action = event.getAction();
              if (action == MotionEvent.ACTION_DOWN){
                  img.setImageResource(R.drawable.port);
              }else if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL){
                  img.setImageResource(R.drawable.bar);
              }               
              return false;
          }
      });
  
  }
  </code></pre>