I have this code that performs action when I touch and release a button. But turns out it releases immediately even though i'm not releasing it yet
switch (v.getId())
{
case(R.id.turnoffall):
if(event.getAction() == MotionEvent.ACTION_DOWN);
{
v.setBackgroundResource(R.drawable.boffall2);
Toast.makeText(getApplicationContext(), "Pressed! ! !",Toast.LENGTH_SHORT).show();
}
if(event.getAction() == MotionEvent.ACTION_UP);
{
v.setBackgroundResource(R.drawable.boffall1);
Toast.makeText(getApplicationContext(), "Released.",Toast.LENGTH_SHORT).show();
}
break;
}
how can I do this right?