It is fired twice because there is a down event and an up event.
The code in the if branch is always executed, since the action is set to 0 (which, by the way, is the value of MotionEvent.ACTION_DOWN).
int action=0; if(action == MotionEvent.ACTION_DOWN)
Perhaps you wanted to write the following code instead?
if(arg1.getAction() == MotionEvent.ACTION_DOWN)
But you really should use the OnClickListener as Wakas suggested.
source share