Reputation: 1216
Scenario: I have 3 imageviews,call these as A,B & C. these are placed one after the another(in series) on the screen. now if i drag my finger from A to C, event of imageview B should raise. Please suggest.
Thanks
Upvotes: 1
Views: 451
Reputation: 9404
You'll need to handle the touch event (override onTouchEvent
or setOnTouchListener
of View
; or override onTouchEvent
of Activity
), and do the following:
getActionMasked
and check for ACTION_DOWN
. Set a flag, say, isDown = true
getActionMasked
and check if(isDown && getActionMasked() == ACTION_MOVE)
and do your work.getPointerCount
to handle multiple ACTION_DOWN
events.Upvotes: 1
Reputation: 33741
Use a GestureDetector and supply the Maths of dragging from A to C. Then when that MotionEvent
occurs, perform the event.
Upvotes: 1