启动Android应用程序,在一个应用程序? [英] Launching Android app, within an app?

查看:154
本文介绍了启动Android应用程序,在一个应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个基本的应用程序。其中一个我很感兴趣,试图做的特点是启动其他应用程序,里面的应用程序已经在运行。

I'm writing a basic application. One of the features I'm interested in trying to do is to launch another app, INSIDE the app already running.

例如。我有3个菜单选项,1和2做某些任务,该父应用程序的一部分的应用程序,菜单选项3启动所安装在手机上的其他应用程序。 我不知道这是可能的吗?

Eg. I have an app with 3 menu options, 1 and 2 do certain tasks as part of this parent app, menu option 3 launches another app that's installed on the phone. I'm not sure if this is possible?

推荐答案

这是可能的的意图机制

的确切意图,你必须写取决于多种因素:

The exact Intent you'll have to write depend on various factors:

  • 请您提供一些数据来启动的应用程序?
  • 请你针对特定应用程序或你想要让用户选择他prefers申请该任务(如果他有几个应用程序能够做你所需要的)?
  • 你要确保应用程序可用? (这将是更好的)
  • 你知不知道,如果其他应用程序提供特定意图过滤器做一些工作?

编辑:

那么,你应该能够启动第二个应用程序具有以下code:

Then, you should be able to start the second application with the following code:

Intent i = new Intent(Intent.ACTION_MAIN);
i.addCategory(Intent.CATEGORY_LAUNCHER);
i.setPackage("com.otherapp.package");
startActivity(i);

将这个code在按钮的OnClickListener这应该是足够了。

Place this code in the OnClickListener of your button and that should be enough.

这篇关于启动Android应用程序,在一个应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆