我写了一个程序,通过Intent.ACTION_VIEW
调用Google Translator android应用程序。 问题是,调用谷歌翻译应用程序不再工作,虽然它只做过一次。Google翻译活动不再工作
的代码是相同的这里给出的代码:
Returning Translated Text from Google Translate Activity
(是的,我想通过代码来代替我的代码,谷歌翻译应用程序的行为,如果它没有接收到任何数据。 )
目前我无法指定文本和两种语言。我能做的最好是使用ACTION_SEND
,但却忽视了两种语言:
Intent i = new Intent();
i.setAction(Intent.ACTION_SEND);
i.putExtra(Intent.EXTRA_TEXT, "What is going on?");
i.putExtra("key_text_input", "What time is it?");
i.putExtra("key_text_output", "");
i.putExtra("key_language_from", "en");
i.putExtra("key_language_to", "es");
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.translation.TranslateActivity"));
,当我跑这个代码是实际发生的事情:谷歌翻译问我,如果我想从英语翻译和翻译“什么正在进行?”法语。
所以:我现在如何将语言传递给Google翻译应用程序?
谢谢..尝试了所有以前的解决方案,他们没有工作,这是令人沮丧的,他们不断改变API和非常ks不断更新我们! – Bruce
实际工作的唯一解决方案是使用该uri。 – Virusman
感谢它的工作 – cuasodayleo