在MainActivity中,我从({https://medium.com/@prakash_pun/text-recognition-for-android-using-google-mobile-vision-a8ffabe3f5d6)中采用了以下方法:
private void startCameraSource() {
...
if (!textRecognizer.isOperational()) {
Log.w(TAG, "Detector dependencies not loaded yet");
} else {
...
//Set the TextRecognizer's Processor.
textRecognizer.setProcessor(new Detector.Processor<com.google.android.gms.vision.text.TextBlock>() {
@Override
public void release() {
}
/**
* Detect all the text from camera using TextBlock and the values into a stringBuilder
* which will then be set to the textView.
* */
@Override
public void receiveDetections(Detector.Detections<FirebaseVisionText.TextBlock> detections) {
...
}
});
}
}
问题是我遇到了错误:error: <anonymous com.example.myqrcodescanner.MainActivity$5> is not abstract and does not override abstract method receiveDetections(Detections<TextBlock>) in Processor
,并且错误指向以下行:textRecognizer.setProcessor(new Detector.Processor<com.google.android.gms.vision.text.TextBlock>() {
有什么想法吗?