1

I got an image on which I set OnTouchListener. When the person moves his finger away from the image, I need to check in which view he lifted the finger(or at least whether he was in same image when lifted finger). I read this and the answer was based on pixel color. Isn't there any way I can get the id of the view in which I lifted the finger? Or some flag which tells me whether I was in same view on which I implemented the OnTouchListener?

This is a little code in which I tried to compare the id of view on ACTION_UP, but it appears to be the same on which I implemented the listener....

tmw2 = (ImageView) findViewById(R.id.temp2);
    tmw2.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View arg0, MotionEvent arg1) {
            if (arg1.getAction() == MotionEvent.ACTION_UP) {
                if (arg0.getId() == R.id.temp2)
            tmw2.setImageResource(R.drawable.downloads_pressed);
            }
            return false;
        }
    });
Community
  • 1
  • 1
berserk
  • 2,690
  • 3
  • 32
  • 63
  • This is not an answer, but a thought. If it is hard to implement, it is probably not a very natural motion for a user as well. Would that really be intuitively meaningful to a user ? – Snicolas Nov 13 '13 at 06:15
  • Yes it is. Suppose I want a button to implement which changes its views. If the user takes his finger away while pressing it, it shouldn't work. But its possible only when I know he didn't lifted his finger in same view. – berserk Nov 13 '13 at 06:29
  • Sorry to insist, but that's not a button anymore. – Snicolas Nov 13 '13 at 06:41
  • I am using an ImageView as button :) – berserk Nov 13 '13 at 06:43

0 Answers0