I have a problem with receiving translations from Google via translate API. Does somebody know what is wrong? Thanks!
Note: It has worked fine for some time but maybe 5 months ago it stopped to work.
@Override
public void onClick(View v) {
GoogleAPI.setHttpReferrer("http://code.google.com/p/google-api-translate-java/");
GoogleAPI.setKey("xxx");
try {
tv_answer.setText(Translate.DEFAULT.execute(tv_source.getText().toString(), Language.CZECH, Language.ENGLISH));
} catch (GoogleAPIException e) {
e.printStackTrace();
}
}
Received error:
com.google.api.GoogleAPIException: java.lang.Exception: [google-api-translate-java] Error retrieving translation.
This problem only appears on android when using this api client. I believe this is because this api client is old and/or poorly written.
You can attempt to get the source code from here and fix the problem yourself, or just use the api directly from Java using GET with HttpURLConnection and them parse the JSON.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With