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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:27:23+00:00 2026-05-17T06:27:23+00:00

Purpose of the app: A simple app that draws a circle for every touch

  • 0

Purpose of the app:

A simple app that draws a circle for every touch recognised on the screen and follows the touch events. On a ‘high pressure reading’ getPressure (int pointerIndex) the colour of the circle will change and the radius will increase. Additionally the touch ID with getPointerId (int pointerIndex), x- and y-coordinates and pressure are shown next to the finger touch.

Following a code snipplet of the important part (please forgive me it is not the nicest code 😉 I know)

protected void onDraw(Canvas canvas){

    //draw circle only when finger(s) is on screen and moves 
    if(iTouchAction == (MotionEvent.ACTION_MOVE)){
        int x,y;
        float pressure;

        //Draw circle for every touch
        for (int i = 0; i < touchEvent.getPointerCount(); i++){
            x = (int)touchEvent.getX(i);
            y = (int)touchEvent.getY(i);
            pressure = touchEvent.getPressure(i);

            //High pressure
            if (pressure > 0.25){
                canvas.drawCircle(x, y, z+30, pressureColor);
                canvas.drawText(""+touchEvent.getPointerId(i)+"  | "+x+"/"+y, x+90, y-80, touchColor);
                canvas.drawText(""+pressure, x+90, y-55, pressureColor);
            }else{ //normal touch event 
                canvas.drawCircle(x, y, z, touchColor);
                canvas.drawText(""+touchEvent.getPointerId(i)+" | "+x+"/"+y, x+60, y-50, touchColor);
                canvas.drawText(""+pressure, x+60, y-25, pressureColor);
            }
        }           
    }
}

The problem:

A HTC Desire running Android 2.1 is the test platform. The app works fine and tracks two finger without a problem. But it seems that the two touch points interfere with each other when they get t0o close — it looks like they circles ‘snap’to a shared x and y axle. Sometimes they even swap the input coordinates of the other touch event. Another problem is that even though getPressure (int pointerIndex) refers to an PointerID both touch event have the same pressure reading.

As this is all a bit abstract, find a video here: http://www.youtube.com/watch?v=bFxjFexrclU

My question:

  1. Is my code just simply wrong?
  2. Does Android 2.1 not handle the touch events well enough get things mixed up?
  3. Is this a hardware problem and has nothing to do with 1) and 2)?

Thank you for answers and/or relinks to other thread (sorry could find one that address this problem).

Chris

  • 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-05-17T06:27:24+00:00Added an answer on May 17, 2026 at 6:27 am

    I hate to tell you this, but it’s your hardware.

    The touch panel used in the Nexus One (which I believe is the same hardware used in the HTC Desire) is known for this particular artifact. We did some work to alleviate the “jumps to other finger’s axis” problem around the ACTION_POINTER_UP/DOWN events for Android 2.2 by dropping some detectable bad events, but the problem still persists when the pointers get close along one axis. This panel is also known for randomly reversing X and Y coordinate data; two points (x0, y0) and (x1, y1) become (x0, y1) and (x1, y0). Sadly there’s only so much you can do when the “real” data is gone by the time Android itself gets hold of it.

    This isn’t the only panel in the wild that has dodgy multitouch capabilities. To tell at runtime if you have a screen capable of precise multitouch data reporting without issues like this, use PackageManager to check for FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT. If you don’t have this feature available you can still do simple things like scale gestures reliably.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For testing purposes I'm planning to put together a little app that will listen
Here is my app status: Purpose - download multiple list files from internet Approach
I have a simple web app built in asp.net webforms c# where and how
The purpose of using a Javascript proxy for the Web Service using a service
The purpose of this component is to test knowledge of a student on a
What is the purpose of annotations in Java? I have this fuzzy idea of
What is the purpose of the Using block in C#? How is it different
What is the purpose of the strdup() function in C?
What exactly is the purpose of the 'obj' directory in .NET?
What is the purpose of the colon before a block in Python? Example: if

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.