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?
OMG! They have changed it once again! They have made it look more reasonable, but not compatible with the previous version.
Intent i = new Intent();
i.setAction(Intent.ACTION_SEND);
i.putExtra(Intent.EXTRA_TEXT, "What is going on?");
i.putExtra("key_text_input", "Oh my God!");
i.putExtra("from", "en");
i.putExtra("to", "zh-CN");
i.setComponent(new ComponentName("com.google.android.apps.translate",
"com.google.android.apps.translate.HomeActivity"));
Looks like this is a SEND intent with two additional (BTW, optional) parameters, "to" and "from".
There's a gotcha: "key_text_input" takes preference over Intent.EXTRA_TEXT, and "to" and "from" work only with "key_text_input".
For people that change the API with each new version it may look only reasonable to rename "key_text_input" to, say, just "text_input", so we will look forward to the next release...
To be on the safe side, I'd propose to set both Intent.EXTRA_TEXT and "key_text_input" to the same value.