I am using the Android onTouchEvent to register touch and the associated movement. I then want to iterate a sprite along that path.
I need to store the path traced by the finger for use later on.
The problem is that after the finger is lifted off the screen the ArrayList (pArray) is completely populated with the X & Y position of the ACTION_UP coordinates.
From the Log i can see that it is adding the current X & Y position to the Arraylist while the finger is moving which is great but then the Arraylist gets overwritten by the data in Arraylist.size() - 1...
Can someone please offer a suggestion.
public boolean onTouchEvent(MotionEvent event){
synchronized (mHeartbeat.getSurfaceHolder()){
getXX = event.getX();
getYY = event.getY();
pathArr.setX(getXX);
pathArr.setY(getYY);
pArray.add(pathArr);
if(event.getAction() == MotionEvent.ACTION_DOWN){
}else if(event.getAction() == MotionEvent.ACTION_MOVE){
}else if(event.getAction() == MotionEvent.ACTION_UP){
}
return true;
}
}