I want to setup up an onTouchListener that changes an ImageViews image resource on ACTION\_UP and ACTION\_DOWN. Here is my code:

```
    // Setup a basic upDownListener that registers UP and DOWN actions and changes the
    // view image resource accordingly
    View.OnTouchListener upDownListener = new View.OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if(event.getAction() == MotionEvent.ACTION_DOWN) {
                // Button was pressed, change button background
                v.setImageResource(R.drawable.button_white_pressure);
                return true;
            } else if(event.getAction() == MotionEvent.ACTION_UP) {
                // Button was released, reset button background
                v.setImageResource(R.drawable.button_white);
                return true;
            }

            return false;
        }

    };

```

This code does not compile because View does not have the method setImageResource, only ImageView. But how do I tell the listener that an ImageView is being used?