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

  • Home
  • SEARCH
  • 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 7602385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:23:56+00:00 2026-05-30T23:23:56+00:00

I have developed application for OCR using tesseract Library, Application got exit during the

  • 0

I have developed application for OCR using tesseract Library,

Application got exit during the execution of following code :

/*...
... Other Code stuff
...*/
    protected Boolean doInBackground(String... arg0) {

    /*...
    ... Other Code stuff
    ...*/
    Pix pix = getPixFromBitmap(bitmap);
    pix = preprocess(pix);
    Pixa pixa = slice(pix); // Code Updated

    try {
        baseApi.setPageSegMode(TessBaseAPI.PSM_SINGLE_LINE);

        int num = pixa.size();

        for (int i = 0; i < num; i++) {
            Pix pixi = pixa.getPix(i);

            /*...
            ... Other Code stuff
            ...*/
        }
        pixa.recycle();
        baseApi.end();

    } catch (RuntimeException e) {
Log.e("OcrRecognizeAsyncTask","Caught RuntimeException in request to Tesseract. Setting state to CONTINUOUS_STOPPED.");
        e.printStackTrace();
        try {
            // baseApi.clear();
            activity.stopHandler();
        } catch (NullPointerException e1) {
            // Continue
        }
        return false;
    }

    private Pixa slice(Pix pix) {
    HydrogenTextDetector htd = new HydrogenTextDetector();
    HydrogenTextDetector.Parameters hydrogenParams = htd.getParameters();
    hydrogenParams.debug = false;
    hydrogenParams.skew_enabled = true;
    htd.setParameters(hydrogenParams);

    htd.setSourceImage(pix);
    pix.recycle();
    htd.detectText();
    Pixa unsorted = htd.getTextAreas();
    Pixa pixa = unsorted.sort(Constants.L_SORT_BY_X, Constants.L_SORT_DECREASING);
    unsorted.recycle();
    htd.clear();
    return pixa;
}

Logcat detail as follow :

02-23 13:37:09.986: I/WindowManager(102): Setting rotation to 0, animFlags=1
02-23 13:37:10.006: I/ActivityManager(102): Config changed: { scale=1.0 imsi=405/30 loc=en_IN touch=3 keys=1/1/2 nav=3/1 orien=1 layout=17 uiMode=17 seq=33}
02-23 13:37:10.116: I/UsageStats(102): Unexpected resume of com.htc.launcher while  already resumed in edu.sfsu.cs.orange.ocr
02-23 13:37:10.816: W/InputManagerService(102): Got RemoteException sending setActive(false) notification to pid 4880 uid 10062

I am converting Bitmap to Leptonica Pix object than Pix to Leptonica Pixa object and than doing OCR reorganization.

During processing, sometime OCR reorganization done successfully and sometime android Home screen come automatically.

I don’t know what is the issue behind that, and why RemoteException warning come?

Please help me to resolve this issue.

Thanks,

  • 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-30T23:23:57+00:00Added an answer on May 30, 2026 at 11:23 pm

    You can not end the baseApi in between the AsyncTask. That is the issue you are stuck with crashing problem.

    You have used following code,

    pixa.recycle();
    baseApi.end();
    

    Comment the following line and than try to run the application, It may solve your problem.

    pixa.recycle();
    // baseApi.end();
    

    ==================================================================================

    Clear the Heap Memory automatically you can implement following code :

    public void onCreate(Bundle savedInstanceState) {
    {
        clearMemoryCountDownTimer mClearMemoryCountDownTimer = new clearMemoryCountDownTimer(5000, 5000).start();
    }
    private class clearMemoryCountDownTimer extends CountDownTimer {
    
        public clearMemoryCountDownTimer(long millisInFuture,
                long countDownInterval) {
            super(millisInFuture, countDownInterval);
        }
    
        @Override
        public void onFinish() {
            start();
            Log.i(TAG, "Timer Finished");
        }
    
        @Override
        public void onTick(long millisUntilFinished) {
            if (Debug.getNativeHeapFreeSize() < 100000) {
                clearMemory();
                Log.i(TAG, "requiredClearMemory");
            }
            Log.i(TAG, "getNativeHeapSize : " + Debug.getNativeHeapSize());
            Log.i(TAG,
                    "getNativeHeapFreeSize : " + Debug.getNativeHeapFreeSize());
            Log.i(TAG,
                    "getNativeHeapAllocatedSize : "
                            + Debug.getNativeHeapAllocatedSize());
    
        }
    
        void clearMemory() {
            Log.i(TAG, "System.gc()-Start");
            System.gc();
            Log.i(TAG, "System.gc()-End");
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed demo application using spring struct and hibernate and getting following error
We currently have developed an application using WCF. Our clients make connections to different
I have developed a window application in VS2005 using C#. I need to integrate
I have developed a Win32 application using C/C++, which runs on Vista and XP.
I have developed a desktop application using C# as frontend and SQL as backend.
I have developed an application which creates an outlook application using outlook object model.
i have developed an application using jsf 1.2. it worked fine with apache tomcat
I have developed an application using J9 that runs in windows mobile. but now
I have developed an application using php, mysql and xajax. I always used to
I have developed an application using Delphi and Firebird 1.5, where the server is

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.