Hello i am new at Android developing and wanted to create a translation app. I read through all the help and also forums and am clueless how to solve the following problem. I am using the bing api in my android project and everytime i tried to test my application i get the following error: [microsoft-translator-api] Error retrieving translation : null.
This is my code:
publicclass MenuOne extends Activity {
@SuppressLint("NewApi")
@Override
protectedvoid onCreate(Bundle savedInstanceState) {
ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu_one);
try {
Toast.makeText(getApplicationContext(), translate("Hello"), Toast.LENGTH_LONG).show();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show();
}
}
public String translate(String text) throws Exception{
// Set the Client ID / Client Secret once per JVM. It is set statically and applies to all services
Translate.setClientId("test");
Translate.setClientSecret("test");
String translatedText = "";
// English AUTO_DETECT -> gERMAN Change this if uwanna other languages
translatedText = Translate.execute(text, Language.ENGLISH, Language.FRENCH);
return translatedText;
}
I have no clue if is an authority error or someting that i forgot. Just on the side note i am using eclipse with the android sdk to develop this. Also i already added the [microsoft-translator-api] jar into the needed folder.
thanks for the help.