Reputation: 1
I watched the tutorial "Make a Text Scanner App - OCR App - Full Tutorial - Android Development". The video author uses a library from ArthurHub and currently the library cannot be used. In the end I switched to the CanHub library. But I get the error:
Cannot resolve method 'setGuidelines' in 'CropImage'
with code as below:
button_capture.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
CropImage.setGuidelines(CropImageView.Guidelines.ON).start(MainActivity.this);
}
});
additionally, I am getting the error
Cannot resolve method 'getUri' in 'ActivityResult'
and
Cannot resolve method 'ActivityResult' in 'CropImageView'
in the code I wrote as below:
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE){
ActivityResult result = CropImageView.ActivityResult(data);
if (resultCode == RESULT_OK) {
Uri resultUri = result.getUri();
try {
bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), resultUri);
getTextFromImage(bitmap);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
How can I solve these problems?
I've tried looking at the documentation at GitHub but still don't understand how to apply the code.
Upvotes: 0
Views: 170