I wrote the following code to find out the coordinates of touch point.
view.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
float val = view.getAlpha();
float xVal = view.getX();
float yVal = view.getY();
String message = "Screen height: " + height + ", width: " + width + "\n" +
"Alpha Value: " + val + ", x Coordinate: " + xVal + ", y Coordinate: " + yVal;
Toast.makeText(MainActivity.this, message, Toast.LENGTH_SHORT).show();
return false;
}
It turns out to be always returning the fixed value, 32.0 for each x coordinate and y coordinate.