I coded program about dictionary sentence and I want to have function to go to \"google translator\" application in my app
How can I use it , Should I import anything?
I have the same problem. Initially, I tried to use Google Translate Ajax API, but since Google have deprecated API version 1 and make version 2 as paid service, my code stops working. Then, I decompiled Google Translate App, looked into the Smali code and got some hint about the logic inside it. Use this code, it works for me:
private void callGoogleTranslateApps(String word, String fromLang, String toLang) {
Intent i = new Intent();
i.setAction(Intent.ACTION_VIEW);
i.putExtra("key_text_input", word);
i.putExtra("key_text_output", "");
i.putExtra("key_language_from", fromLang);
i.putExtra("key_language_to", toLang);
i.putExtra("key_suggest_translation", "");
i.putExtra("key_from_floating_window", false);
i.setComponent(new ComponentName("com.google.android.apps.translate", "com.google.android.apps.translate.TranslateActivity"));
startActivity(i);
}