Reputation: 1575
Hi I have loaded dynamically images in different position using single image view instance. my problem is if I touch particular image second image also affected 1st I wish to find which image is touched. i want to print which image is touched. I am suffer in this task please help me.
my problem is i have only one imageview to show all images in appropriate location. I received xml file that xml contain everything like image size, image position ...etc I am loading dynamically images because i receive xml file dynamically. if i touch one image i wish to identify which image is clicked in the design that's all
This is my screen shot:
Upvotes: 0
Views: 1181
Reputation: 447
Firtly implements onTouchListener then override the method,
ImageView one = ....
ImageView two = ....
one.SetTag("ITEM ONE");
two.SetTag("ITEM TWO");
one.setOnTouchListener(this);
two.setOnToucListener(this);
@Override
public boolean onTouch(View v, MotionEvent event) {
if(v == one)
{
Log.e("Touched Itemd: ",(String) v.getTag().toString());
}
if(v == two)
{
Log.e("Touched Itemd: ",(String) v.getTag().toString());
}
}
Upvotes: 1