Created
March 1, 2018 13:51
-
-
Save nandantal/c720cd03822a415d69cb68f2817e092f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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