如何将用户发送到另一个应用程序

时间:2014-08-05 11:27:40

标签: android

我正在尝试将我的OCR项目的用户发送到OFFLINE Google Translator,但我不知道应该用什么来实现这一目标......

我搜索了很多,但没有达到我想要的。

我想过将Intent与动作“View”

一起使用
 Intent intent=new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW)
我明白这一点 it's not what actually i need

帮助PLZ

2 个答案:

答案 0 :(得分:1)

Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage("com.google.android.apps.translate");
startActivity(LaunchIntent);

答案 1 :(得分:0)

您需要启动引用相关应用的应用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);
}
相关问题