在另一个Android应用程序中调用活动从APK [英] Invoking activity from APK in another android application
问题描述
我有一个启动活动,并运行良好的android应用。我需要其他开发人员能够到我的APK集成到他们的应用程序以这样的方式,他们可以从自己的Android应用程序开始在我的APK活动。
I have an android application that starts an activity and is running well. I need other developers to be able to integrate my APK into their applications in such a way that they can start the activity in my APK from their android applications.
什么是实现这一目标的方法是什么?
What are the ways of achieving this?
谢谢 乔治
推荐答案
做的最好的事情,恕我直言,是您的活动的清单中声明的自定义操作。是这样的:
The best thing to do, IMHO, is declare a custom action in an in your activity's manifest. Something like:
<activity android:name="Foo">
<intent-filter>
<action android:name="com.commonsware.android.THIS_IS_MY_ACTION" />
</intent-filter>
</activity>
那么,你的同胞可以通过该自定义操作启动它:
Then, your compatriots can launch it via that custom action:
startActivity(new Intent("com.commonsware.android.THIS_IS_MY_ACTION"));
通过命名空间你的行动,你应该不会遇到与其他人的应用程序意外冲突。
By namespacing your action, you should not run into accidental conflicts with anyone else's app.
这篇关于在另一个Android应用程序中调用活动从APK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!