Emre Akbaki Emre Akbaki - 27 days ago 17
Android Question

How can ı fix response text?

I use Google Cloud Vision Api (Text_Detection) it is working normal but when ı return answer from the Google, message style like image

I want just one text e.g "ACADEMIC PLANNER" so how can ı remove front of Academic "null:" and other words ?

İmage e.g

enter image description here

And here is my code ;

private String convertResponseToString(BatchAnnotateImagesResponse response) {
String message = "I found these things:\n\n";

List<EntityAnnotation> labels = response.getResponses().get(0).getTextAnnotations();
if (labels != null) {
for (EntityAnnotation label : labels) {
message += String.format("%.3f: %s", label.getScore(), label.getDescription());
message += "\n";
}
} else {
message += "nothing";
}

return message;
}

Answer

Answer: private String convertResponseToString(BatchAnnotateImagesResponse response) { String message = "I found these things:\n\n"; List labels = response.getResponses().get(0).getTextAnnotations(); if (labels != null) { message += labels.get(0).getDescription(); } else { message += "nothing"; } return message; }

Comments