Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8922855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:57:15+00:00 2026-06-15T06:57:15+00:00

how to draw an arrow in android touch event? i m trying to draw

  • 0

how to draw an arrow in android touch event?

i m trying to draw seperate straight line and an arrow head.how to set the arrowhead at the right position?

currentDrawingPath1.path.lineTo(motionEvent.getX()+5, motionEvent.getY());
currentDrawingPath1.path.lineTo(motionEvent.getX()-5, motionEvent.getY());
currentDrawingPath1.path.lineTo(motionEvent.getX(), motionEvent.getY());

above code is to draw a arrow head.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T06:57:16+00:00Added an answer on June 15, 2026 at 6:57 am

    i tried this below code.this is worked for me,

    enter code here
    
    
    switch (event.getAction())
    {
       case MotionEvent.ACTION_DOWN:
            mPath.reset();
        mPath.moveTo(x, y);
            mX = x;
            mY = y;
            startPoint = new PointF(event.getX(), event.getY());
            endPoint = new PointF();
            invalidate();
    
         //   isDrawing = true;
            break;
        case MotionEvent.ACTION_MOVE:
                float dx = Math.abs(x - mX);
            System.out.println("action move");
            float dy = Math.abs(y - mY);
            if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE)
            {
            //  currentDrawingPath.path.quadTo(mX,mY,(x + mX)/2, (y + mY)/2);
            }
            mX = x;
            mY = y;
              endPoint.x = event.getX();
                endPoint.y = event.getY();
              isDrawing = true;
    
              invalidate();
            break;
        case MotionEvent.ACTION_UP:
               mPath.lineTo(mX, mY);
    float deltaX =   endPoint.x-startPoint.x;
               float deltaY =   endPoint.y-startPoint.y;
               float frac = (float) 0.1;
    
               float point_x_1 = startPoint.x + (float) ((1 - frac) * deltaX + frac * deltaY);
               float point_y_1 = startPoint.y + (float) ((1 - frac) * deltaY - frac * deltaX);
    
               float point_x_2 = endPoint.x;
               float point_y_2 = endPoint.y;
    
               float point_x_3 = startPoint.x + (float) ((1 - frac) * deltaX - frac * deltaY);
               float point_y_3 = startPoint.y + (float) ((1 - frac) * deltaY + frac * deltaX);
    
    
    
               mPath.moveTo(point_x_1, point_y_1);
               mPath.lineTo(point_x_2, point_y_2);
               mPath.lineTo(point_x_3, point_y_3);
               mPath.lineTo(point_x_1, point_y_1);
               mPath.lineTo(point_x_1, point_y_1);
    
                mCanvas.drawPath(mPath, ppaint);
                endPoint.x = event.getX();
                endPoint.y = event.getY();
                isDrawing = false;
    
                invalidate();
            break;
        default:
            break;
    }       
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to draw a directed arrow line through Java. At present, I am
I need a software to draw vectors (line with an arrow) in 3D. Also
How can i draw an arrow using the graphics class? Im using android graphics
I want to draw an arrow using Graphic fillpolygon. But my arrow head is
I draw a line in a zedgraph pane, but sometimes it will be like
I draw the text using CTFramesetter, I have set kCTParagraphStyleSpecifierParagraphSpacing , kCTParagraphStyleSpecifierLineSpacing , kCTParagraphStyleSpecifierParagraphSpacingBefore
Windows seems to draw the submenu arrow after I have done my painting in
I'm trying to create a simple window in Win32 and draw a rectangle in
So in winforms, every dropdown combobox has this little arrow thingy to the right
How can I draw an arrowed line between two circles, given: Location of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.