10
public boolean onTouchEvent(MotionEvent event) {
TextView tv=new TextView(this);
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_MOVE:
case MotionEvent.ACTION_UP:
x = event.getX();
y = event.getY();
RelativeLayout gh = (RelativeLayout) findViewById(R.id.relative1);
RelativeLayout.LayoutParams para = new RelativeLayout.LayoutParams(150, 50); //Size of textView
para.leftMargin = (int) x; //location of textview
para.topMargin = (int) y;
tv.setLayoutParams(para);
tv.setText("You have Touched at "+x+" ,"+y);
change();
gh.addView(tv);
}