I'm trying out some functions and basically learning stuff, and I don't know why this isn't working. I mean when I first touch down the image changes to R.drawable.buttondown, but then when I move my finger or release it the other cases do not work and the image doesn't change anymore. Can you tell me why?
icon = (ImageView)findViewById(R.id.imageView1);
icon.setOnTouchListener(new OnTouchListener(){
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()){
case MotionEvent.ACTION_DOWN:
icon.setImageResource(R.drawable.buttondown);
break;
case MotionEvent.ACTION_UP:
icon.setImageResource(R.drawable.ic_launcher);
break;
case MotionEvent.ACTION_MOVE:
icon.setImageResource(R.drawable.abc_ab_bottom_transparent_dark_holo);
break;
}
return false;
}