由网友(泪流成河╮)分享简介:我想从另一个应用程序调用一款使用Android操作系统的应用程序I want to call one android application from another application 我已经尝试了一些examples,但他们没有工作对我来说,我得到一个包解析错误。I have tried some exa...
我想从另一个应用程序调用一款使用Android操作系统的应用程序
I want to call one android application from another application
我已经尝试了一些examples,但他们没有工作对我来说,我得到一个包解析错误。
I have tried some examples, but they are not working for me, I'm getting a Package parse error.
假设有两个应用:应用1和应用2
Consider there are two applications: Application1 and Application2
我想从应用程序1调用应用2
I want to call Application2 from Application1
下面是一些示例code要做到这一点:
Here is the some sample code to do this:
Intent i = new Intent();
i.setAction(android.content.Intent.ACTION_VIEW);
i.setDataAndType(Uri.fromFile(fileName),"application/vnd.android.package-archive");
startActivity(i);
下面文件名=文件://data/data/package_name/files/Application1.apk;
推荐答案
我觉得这$ C $ C可以帮助:
I think this code will help:
Intent intent = new Intent(Intent.ACTION_RUN);
intent.setComponent(new ComponentName("<packet name>", "<class name>"));
List list = packageManager.queryIntentActivities(intent, packageManager.COMPONENT_ENABLED_STATE_DEFAULT);
if(list.size() > 0)
{
Log.i("Log", "Have application" + list.size());
startActivity(intent);
}
else
{
Log.i("Log", "None application");
}
相关推荐
最新文章