I defined onTouchEvent(MotionEvent event) to receive touch events for imageview. I am using multiple imageviews and i have to find for which imageview I have received touch event. Is it possible to get imageview inside onTouchEvent?
public void createImageViews()
{
int i = 0;
imageArray[0] = (ImageView)findViewById(R.id.image1);
imageArray[1] = (ImageView)findViewById(R.id.image2);
imageArray[2] = (ImageView)findViewById(R.id.image3);
imageArray[3] = (ImageView)findViewById(R.id.image4);
imageArray[4] = (ImageView)findViewById(R.id.image5);
imageArray[5] = (ImageView)findViewById(R.id.image6);
for (i = 0; i < count; i++)
{
imageArray[i].setOnTouchListener(this);
}
}
public class Touch extends Activity implements OnTouchListener, AnimationListener { }
I have tried using
public boolean onTouch(View v, MotionEvent event) { } but not receiving the touch events.
After starting the animation on imageview I did not observe touch events in onTouch() and getting touch events in onTouchEvent() . imgArray[g_animCount].startAnimation(movArray[g_animCount]);