private void startOCR(Uri imgUri){
  try {
    BitmapFactory.Options options=new BitmapFactory.Options();
    options.inSampleSize=4;
    Bitmap bitmap=BitmapFactory.decodeFile(imgUri.getPath(),options);
    result=extractText(bitmap);
    textView.setText(result);
  }
 catch (  Exception e) {
    Log.e(TAG,e.getMessage());
  }
}

private void startOCR ( Uri imgUri ) { try { BitmapFactory . Options options = new BitmapFactory . Options ( ) ; options . inSampleSize = 4 ; Bitmap bitmap = BitmapFactory . decodeFile ( imgUri . getPath ( ) , options ) ; result = extractText ( bitmap ) ; textView . setText ( result ) ; } catch ( Exception e ) { Log . e ( TAG , e . getMessage ( ) ) ; } }
don ' t run this code in main thread - it stops ui thread . create asynctask instead . http : / / developer . android . com / intl / ru / reference / android / os / asynctask . html
