Skip to content

Instantly share code, notes, and snippets.

@zurche

zurche/checkImage.java

Last active Feb 13, 2017
Embed
What would you like to do?
LogoBodyModel logoBodyModel = LogoPostBuilder.buildLogoDetectionBody(encodedImage);
Call<LogoResponse> checkImageCall = mService.checkImageLogo(logoBodyModel);
checkImageCall.enqueue(new Callback<LogoResponse>() {
@Override
public void onResponse(Call<LogoResponse> call, Response<LogoResponse> response) {
Log.d(TAG, "Got Response");
if(response.body().getResponses() != null &&
response.body().getResponses().get(0).getLogoAnnotations() != null) {
Log.d(TAG, "It's a: " + response.body().getResponses().get(0).getLogoAnnotations().get(0).getDescription());
Log.d(TAG, "With a Score of: " + response.body().getResponses().get(0).getLogoAnnotations().get(0).getScore());
} else {
Log.d(TAG, "Empty response");
textView.setText("No idea!");
}
}
@Override
public void onFailure(Call<LogoResponse> call, Throwable t) {
Log.e(TAG, "Response Failed");
t.printStackTrace();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.