cloud ocr sdk from file

  • 940 Views
  • Last Post 17 March 2016
harun_498 posted this 16 December 2015

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.

Order By: Standard | Newest | Votes
harun_498 posted this 21 December 2015

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

Beliakova Svetlana posted this 17 March 2016

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.

Close