i m using abby's code sample for android. i clicked the "from camera" button. its working fine. But i clicked "from file",i choose the image but then nothing happens just shows activity result.

asked 16 Dec '15, 19:20

harun_498's gravatar image

harun_498
112

edited 17 Dec '15, 18:58


android lolipop path problem here is the solution

go to MainActivity.java below "SELECT_FILE" change

Uri imageUri = data.getData();

        String[] projection = { MediaStore.Images.Media.DATA };
        Cursor cur = managedQuery(imageUri, projection, null, null, null);
        cur.moveToFirst();

        imageFilePath = cur.getString(cur.getColumnIndex(MediaStore.Images.Media.DATA));

TO

Uri imageUri = data.getData();

            String wholeID = DocumentsContract.getDocumentId(imageUri);

            // Split at colon, use second item in the array
            String id = wholeID.split(":")[1];

            String[] column = { MediaStore.Images.Media.DATA };

            // where id is equal to
            String sel = MediaStore.Images.Media._ID + "=?";

            Cursor cursor = getBaseContext().getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
                    column, sel, new String[]{ id }, null);

            assert cursor != null;
            int columnIndex = cursor.getColumnIndex(column[0]);

            if (cursor.moveToFirst()) {
                imageFilePath = cursor.getString(columnIndex);
            }
            cursor.close();

!!!!DO NOT FORGET

-add @SuppressLint("NewApi") on top of public void onActivityResult(int requestCode, int resultCode, Intent data)

-import android.annotation.SuppressLint;

-import android.provider.DocumentsContract;

http://stackoverflow.com/questions/29646975/how-to-get-file-path-of-image-from-uri-in-android-lollipop

link

answered 21 Dec '15, 23:07

harun_498's gravatar image

harun_498
112

edited 21 Dec '15, 23:15

Hi, Sorry for the delay with the response. I have tested your scenario of working and everything goes well on our side when we click "from file". I mean the document is loaded to the program and then the program can recognize the document.If you still couldn`t run our sample please explain in more details how you run our sample. Please send us an e-mail to cloudocrsdk@abbyy.com.

(17 Mar '16, 15:21) Beliakova Sv... ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×53

Asked: 16 Dec '15, 19:20

Seen: 910 times

Last updated: 17 Mar '16, 15:21

© 2016 ABBYY. All rights Reserved. www.ABBYY.com | Privacy Policy | Legal