相关疑难解决方法(0)

Google翻译活动不再有效

我写了一个程序,通过调用谷歌翻译android应用程序Intent.ACTION_VIEW.问题是,调用谷歌翻译应用程序不再有效,尽管它曾经做过一次.

代码与此处给出的代码相同:

从Google翻译活动中返回翻译的文本

(是的,我尝试用该代码替换我的代码,Google Translator App的行为就好像它没有收到任何数据.)

目前我无法指定文本和两种语言.我能做的最好就是使用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"));
Run Code Online (Sandbox Code Playgroud)

我运行此代码时实际发生的事情是:Google Translator问我是否要翻译英文并翻译"发生了什么事?" 到法国.

那么:我现在如何将语言传递给Google翻译应用程序?

android google-translate android-intent

5
推荐指数
2
解决办法
3666
查看次数

标签 统计

android ×1

android-intent ×1

google-translate ×1