Which code should I put in the comment in the following OnTouch
function so that the image, CIRCLE1, moves to the right or left when the right or left part of the screen is touched? As you can see I tried to use
float X = ImageView.getX(); X++;
How could I improve this?
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (v.getId()) {
case R.id.circle1:
if (event.getAction() == MotionEvent.ACTION_DOWN) {
//WHAT CODE SHOULD I PUT INSTEAD OF THE FLOAT X AND X++
float X = ImageView.getX();
X++;
}
break;
}
return false;
}