Sorry I just started android and I watched the tutorial “Make a Text Scanner App – OCR App – Full Tutorial – Android Development” on Youtube. He 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();
}
}
}
}
is there anyone who can help me?
I’ve tried looking at the documentation at Github but still don’t understand how to apply the code.
Cahyo Priambodo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.