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 8328143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:20:48+00:00 2026-06-09T01:20:48+00:00

I am creating a application in which i want to draw the shape of

  • 0

I am creating a application in which i want to draw the shape of touch event in my screen.Any ApI to get the shape of the touch event particularly?

Any examples or code snippets is greatly appreciated.

Thanks
Narayan

  • 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-09T01:20:50+00:00Added an answer on June 9, 2026 at 1:20 am

    This code snippet should achieve what you want:

    public class TestActivity extends Activity {
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(new DrawingView(this));
        }
    
        class DrawingView extends SurfaceView {
    
            private final SurfaceHolder surfaceHolder;
            private final Path path = new Path();
            private final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    
            public DrawingView(Context context) {
                super(context);
                surfaceHolder = getHolder();
                paint.setStyle(Paint.Style.STROKE);
                paint.setStrokeWidth(3);
                paint.setColor(Color.WHITE);
            }
    
            @Override
            public boolean onTouchEvent(MotionEvent event) {
                switch(event.getAction()) {
                case MotionEvent.ACTION_DOWN:
                    path.moveTo(event.getX(), event.getY());
                    break;
                case MotionEvent.ACTION_MOVE:
                    if (surfaceHolder.getSurface().isValid()) {
                        Canvas canvas = surfaceHolder.lockCanvas();
                        path.lineTo(event.getX(), event.getY());
                        canvas.drawPath(path, paint);
                        surfaceHolder.unlockCanvasAndPost(canvas);
                    }
                    break;
                }
                return true;
            }
    
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating an application which uses the facebook api, and I want facebook
i am creating an application in which i want to get the current location
I am creating an application in which I want to access a web service
I am creating one application in which i am using jsp/servlet.. I want to
I'm creating a phonegap application which involves backbone.js, underscore.js, and require.js I want to
I am creating Facebook application which get insights for user's page for multiple metric.
I am creating one desktop application in which I want to track user activity
I am creating an iphone application in which I want the same facility as
I am creating an application in which i want to add record in the
Actually i am creating an application in which i want to load images from

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.