Getting X,Y Co-ordinates ?

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Getting X,Y Co-ordinates ?

Postby Andy » Tue Dec 23, 2008 1:55 pm

Hi All,

How to get the screen (X,Y) Co-ordinates of the pointer pressed in touch screen.


Is there any method avaliable ?


Regards,
Andy
A n D r O i D
Andy
Junior Developer
Junior Developer
 
Posts: 13
Joined: Fri Dec 19, 2008 2:53 pm

Top

Postby logtoavi » Tue Dec 23, 2008 2:28 pm

ye there is option

take alook at this code

@Override
public boolean onTouchEvent(MotionEvent motion){
int x = (int)motion.getX();
int y = (int)motion.getY();
}
Thanks and Regards
Avishek Kumar
logtoavi
Freshman
Freshman
 
Posts: 9
Joined: Wed Dec 17, 2008 11:30 am
Location: Noida

Postby Andy » Tue Dec 23, 2008 3:08 pm

Thanks logtoavi!!


Just discovered the same thing here..... :)


Regards,
Andy
A n D r O i D
Andy
Junior Developer
Junior Developer
 
Posts: 13
Joined: Fri Dec 19, 2008 2:53 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 3 guests