I think you need to use move event rather than touch event and compare getX and getY with the location of your views Override public boolean onTouchEvent(MotionEvent ev) { final int action = ev.getAction(); switch (action) { // MotionEvent class constant signifying a finger-down event case MotionEvent. ACTION_DOWN: { break; } // MotionEvent class constant signifying a finger-drag event case MotionEvent. ACTION_MOVE: { X = ev.getX(); Y = ev.getY(); //compare here using a loop of your views break; } // MotionEvent class constant signifying a finger-up event case MotionEvent.
ACTION_UP: break; } return true; }.
I think you need to use move event rather than touch event and compare getX and getY with the location of your views. @Override public boolean onTouchEvent(MotionEvent ev) { final int action = ev.getAction(); switch (action) { // MotionEvent class constant signifying a finger-down event case MotionEvent. ACTION_DOWN: { break; } // MotionEvent class constant signifying a finger-drag event case MotionEvent.
ACTION_MOVE: { X = ev.getX(); Y = ev.getY(); //compare here using a loop of your views break; } // MotionEvent class constant signifying a finger-up event case MotionEvent. ACTION_UP: break; } return true; }.
I have several ImageViews, and I want the onTouch event to fire for each of them when I drag my finger across multiple images. At present the onTouch event is only firing on the first ImageView (or actually on multiple ImageViews but only when multitouching the screen). Am I barking up completely the wrong tree?
Thanks for any help.
I think you need to use move event rather than touch event and compare getX and getY with the location of your views.
Yes, I had the same problem. The answer was to create a touch listener for the layout I embed my ImageViews in and then to calculate the X, Y position to know above which of my View am I. OnTouchListener is called only for the view it is connected to.
I mean if it is called for an ImageView it won't fire until you start your motion onto that ImageView, as far as I know.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.