import android.os.Bundle;

import android.app.Activity;
import android.view.MotionEvent;
import android.widget.LinearLayout;
import android.widget.Toast;

public class MainActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public boolean onTouchEvent(MotionEvent event) {
String stringEvent = "";
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
stringEvent = "ACTION_DOWN";
break;
case MotionEvent.ACTION_UP:
stringEvent = "ACTION_UP";
break;
case MotionEvent.ACTION_MOVE:
stringEvent = "ACTION_MOVE";
break;
}
String x = String.valueOf(event.getX());
String y = String.valueOf(event.getY());
String sTime =String.valueOf( event.getDownTime() );
Toast.makeText(getApplicationContext(), stringEvent+ "\n" + "Time:" + sTime + "\n" + "X:" + x + "\n" + "Y:" + y, Toast.LENGTH_SHORT).show();
return super.onTouchEvent(event);
}
}