My problem is that when I try to drag an item into my ListView, I do not always get the ACTION_DOWN event. I received many ACTION_MOVE events and only one ACTION_UP event. It is not always so. I got ACTION_DOWN 3 times. It confused me.
I looked at similar questions, but the answers do not seem to suit me. Can anyone think why this is happening?
thanks
//list_client -- a listview list_client.setOnTouchListener(new View.OnTouchListener() { float f1 = -1, f2 = -1 ; @Override public boolean onTouch(View v, MotionEvent event) { switch(event.getAction()){ case MotionEvent.ACTION_DOWN: f1 = event.getRawY(); break; case MotionEvent.ACTION_MOVE: f2 = event.getRawY(); if(f2 - f1 > 50){ if(View.VISIBLE != rl_search_and_add.getVisbility() && ){ rl_search_and_add.setVisibility(View.VISIBLE); } f1 = f2; }else if (f2 - f1 < -50){ rl_search_and_add.setVisibility(View.GONE); f1 = f2; } break; case MotionEvent.ACTION_UP: f1 = -1; f2 = -1; break; } return false; } });
source share