'CanHub image cropper 3 errors, i no the arthurhub is deprecated and this one is similar
I need help on these issues as the android image cropper from Arthurhub is deprecated and the other version from canhub image cropper is the one im using. I am doing an scan receipt function using a ocr scanner but android studio has since updated and there is no suitable tutorial on this version on line anywhere.
**@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scan_receipt);
getOCRDataBtn = findViewById(R.id.getOCRDataBtn);
ocrDataTextView = findViewById(R.id.ocrDataTextView);
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.CAMERA}, CAMERA_REQUEST_CODE);
}
getOCRDataBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CropImage.setGuidelines(Guidelines.ON).start(ScanReceipt.this);>I need help on this line as im using can hub android image cropper
}
});
copyOCRDataBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String scanText = ocrDataTextView.getText().toString();
copyToClipboard(scanText);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(resultCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE)
{
CropImage.ActivityResult result = CropImage.ActivityResult.getActivityResult(data);>I need help on this line as im using can hub android image cropper
if(resultCode == RESULT_OK)
{
Uri resultUri = result.getUri();>I need help on this line as im using can hub android image cropper
try {
bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), resultUri);
getTextFromImage(bitmap);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}**
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
