【问题标题】:How to send user to another application如何将用户发送到另一个应用程序
【发布时间】:2014-08-05 19:44:26
【问题描述】:

我正在尝试将我的 OCR 项目的用户发送到离线谷歌翻译,但我不知道应该使用什么来实现这一点...

我已经搜索了很多,但没有找到我想要的。

我考虑过将 Intent 与动作“查看”一起使用

 Intent intent=new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW)

我看到了 it's not what actually i need

请帮忙

【问题讨论】:

  • 有什么问题吗?并且有任何应用离线谷歌翻译吗??

标签: android


【解决方案1】:
Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage("com.google.android.apps.translate");
startActivity(LaunchIntent);

【讨论】:

    【解决方案2】:

    您需要启动一个引用相关应用的应用 ID(包名称)的意图。试试这个:

    public static void launchGoogleTranslateApp(Activity activity) {
        PackageManager manager = activity.getPackageManager();
        Intent intent = manager.getLaunchIntentForPackage("com.google.android.apps.translate");
        intent.addCategory(Intent.CATEGORY_LAUNCHER);
        activity.startActivity(intent);
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-02-03
      • 2020-09-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多