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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:35:11+00:00 2026-06-13T23:35:11+00:00

I have a handwriting recognition app – the user draws with their finger, the

  • 0

I have a handwriting recognition app – the user draws with their finger, the app recognizes characters. The recognition engine runs in a worker thread that has the the minimal possible priority – Thread.MIN_PRIORITY. It’s a purely CPU/memory algorithm, no I/O whatsoever. Still, when the thread is actively working, the UI becomes rather choppy. The finger strokes take a noticeable delay to appear. I also notice touch events getting lost.

Isn’t that exactly what threading was supposed to help avoid? Why is the UI thread starved for CPU? How do convince the system to treat the worker thread as, well, a low-priority background thread?

It looks like the system is introducing (willingly or because of CPU starvation) a delay between invalidate() and onDraw(). Can I somehow lower that delay?

Testing on relatively old hardware – HTC Magic with Android 2.1.

  • 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-13T23:35:12+00:00Added an answer on June 13, 2026 at 11:35 pm

    Had same problem, so I made my thread:

    1. Thread.yield() after processing a chunk of work.

    2. Limited updates posted to UI thread with a min 500 ms interval (causing much less re-draw).

    3. Made the worker work on prioritized buckets of data, this focuses on updating the views, user is currently interacting with.

    Now the whole UI is really lazy, but free of lag.

    Here’s what my worker’s scheduling method looks like (actual work is done by Process method):

    //--low priority
    Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
    
    //--as long as there's more work to do, and not cancelled--
    while (mPriorityBuffer.hasNext() && !isCancelled()) {
    
        //--get the work with highest priority--
        Work next = mPriorityBuffer.getNext();
    
        //--do work--
        Update u = mProcessor.process(next);
    
        // collect updates for main thread
        mUpdates.push(u);
    
        long timeNow = Calendar.getInstance().getTimeInMillis();
        if(timeNow - timeLast > 500){
            //--its been quite a while now, update ui--
            postUpdatesToMainThread();
            timeLast = timeNow;
        }
    
        //--let UI thread work on updates--
        Thread.yield();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently discovered that all Windows 7 machines have an handwriting recognition API within
I have a requirement in my iPhone app which is something similar to Handwriting
As part of an Offline Handwriting Recognition program, i have a large set of
i want to implement handwriting recognition in my project for example when user writes
Have a look on following application http://itunes.apple.com/us/app/fatbooth/id372268904?mt=8 i think they are using the same
I am developing an handwriting recog tool for android and I have planned to
I am looking to use handwriting recognition and OCR in a piece of software
I have an iPad/iPhone app and when I pick a font for my label
I have a 16x16 matrix of grayscale values representing handwriting digits. Is there a
Have you determined a maximum number of characters allowed in FCKEditor ? I seem

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.