Android Intent:使用来自具有相同sharedUserId的另一个应用程序的类名开始活动 [英] Android Intents: Start activity using class name from another app that has the same sharedUserId

查看:81
本文介绍了Android Intent:使用来自具有相同sharedUserId的另一个应用程序的类名开始活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我所有的应用程序都具有相同的sharedUserId.我想使用当前应用程序的类来启动另一个应用程序的类.我想使用Intent Extras,但我不想使用Intent URL.我也不想不必更改目标活动应用程序的AndroidManifest.

All my apps have the same sharedUserId. I would like to start a class of another app using the class of my current app. I want to use intent extras but I do not want to use intent URLs. I also would prefer not to have to change the AndroidManifest of my target activity's app.

推荐答案

由于您设置了sharedUserId,因此非常简单.

Its pretty easy since you have the sharedUserId set.

Intent res = new Intent();
String mPackage = "com.your.package";
String mClass = ".actYouAreLaunching";
res.setComponent(new ComponentName(mPackage,mPackage+mClass));
startActivity(res);

仅此而已.您可以像往常一样添加额外的意图.

And that's all there is to it. You can add intent extras like you normally would.

这篇关于Android Intent:使用来自具有相同sharedUserId的另一个应用程序的类名开始活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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