Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
mTextRecognizer.setProcessor(new Detector.Processor() {
@Override
public void release() {
}
@Override
public void receiveDetections(Detector.Detections detections) {
SparseArray items = detections.getDetectedItems();
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < items.size(); ++i) {
TextBlock item = items.valueAt(i);
if (item != null && item.getValue() != null) {
stringBuilder.append(item.getValue() + " ");
}
}
final String fullText = stringBuilder.toString();
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
public void run() {
mTextView.setText(fullText);
}
});
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment