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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:49:23+00:00 2026-05-31T02:49:23+00:00

I currently trying to carry out the same operation (OCR) on images in android,

  • 0

I currently trying to carry out the same operation (OCR) on images in android, one option is to use the camera and the other is to load an image from the SD-CARD. The code works when taken from a camera where the code is

Bitmap bitmap = BitmapFactory.decodeFile(_path,options);

where _path is equal to the last image taken using the application ( _path = DATA_PATH + "ocr.jpg"; ) . However when I try to use an image selected from the gallery where _path would equal,

imageCaptureUri = data.getData();
_path = imageCaptureUri.getPath();

The program locks up with the error

Failure deleiving result ResultInfo{who=null, request = 2, result = -1, data=intent {dat=content://media/external/images/media/26 typ=image/jpeg(has extras)}} to activity{com.project.projectActivity}: java.lang.NullPointerException

If anybody has an idea of whats going on I’d like to hear from you !!

  • 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-31T02:49:24+00:00Added an answer on May 31, 2026 at 2:49 am

    You can get path of the image as..

    _path = getPath(imageCaptureUri);
    
    
    public String getPath(Uri uri) {
    String[] projection = { MediaColumns.DATA };
    Cursor cursor = managedQuery(uri, projection, null, null, null);
    column_index = cursor
        .getColumnIndexOrThrow(MediaColumns.DATA);
    cursor.moveToFirst();
    imagePath = cursor.getString(column_index);
    
    return cursor.getString(column_index);
    }
    

    and then

    Bitmap bitmap = BitmapFactory.decodeFile(_path,options);
    

    Note : If you are cropping image then this method does not work in this case Gallery will generate cropped image on same directory of image which you are cropping.

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

Sidebar

Related Questions

My employer is currently trying out Fogbugz and one feature that would be nice
I'm currently trying to switch from Coda (a Mac IDE) to Vim. One thing
I am currently trying to use the php function 'include' to include an external
I currently trying to setup Amazon Load Balancer for Tomcat workers, but I faced
Im currently trying to implement the simple bouncing ball (in 2d) on my android
I'm currently trying out db4o (the java version) and I pretty much like what
Currently trying to figure out how best to process the following sample XML data:
Im currently trying to use a jQuery plugin: jQuery Autocomplete Tokenizer Now after posting
Currently trying at add ajax to a site, after much reading I discovered that
Im currently trying to downlaod a audio track from a WCF, i need some

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.