Search code examples
androidandroid-layoutandroid-screenandroid-screen-supportandroid-gesture

Get Android Pixel Values


I have searched alot of this issue on google but unable to get any help.My question is how to get pixel position of android screen where the user has tapped?


Solution

  • this does the job.

    public boolean onTouchEvent(MotionEvent event) {
    
            float x = event.getX();
            float y = event.getY();