I am setting an OnTouchListener to a ImageView and then duplicating the same ImageView on MotionEvent.ACTION_DOWN as follows
if (me.getAction() == MotionEvent.ACTION_DOWN) {
i++;
image = new ImageView(this);
image.setImageBitmap(btn.getDrawingCache());
image.setId(i);
//image.setOnTouchListener(dragit);
layout.addView(image, i, params);
}
the same follows for ACTION_MOVE and ACTION_UP.
Now after the new View is generated I try to set an OnTouchListener for that as image.setOnTouchListener(dragit);
But the problem is I can create 1000 such ImageViews, how do I end up recognizing them uniquely? I had set an id for each imageview but how do I reference it back?
add imageViews into an array or list and then in onTouch event compare the view with the views from your list