i have text View in layout and set text in layout..now i want to maove this text on touch event means depends on the motion event ..so how to move this text and set text , where i put off my finger from screen..i searched in Google and found , can get x and y cordinates of screen using ,event.getX() and ,y= + event.getY()..but how to use it to set the text at that position only..
TextView textView = (TextView)findViewById(R.id.textView);
// this is the view on which you will listen for touch events
View touchView = findViewById(R.id.touchView);
touchView.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
}}
}
thanks
your question is not clear what do you mean by moving text on touch ? you want to move the text where finger touches ? if you want this then make two variables x and y in activity and update them with like this.