简体   繁体   English

Android程序流程帮助

[英]Android Program Flow Help

Consider the following: 考虑以下:

I have three packages: 我有三个包:

package.a package.a
package.b package.b
package.c package.c

Each package contains a class and an activity 每个包都包含一个类和一个活动

package.a>>activity.a>>class.a package.a >> activity.a >> class.a
package.b>>activity.b>>class.b package.b >> activity.b >> class.b
package.c>>activity.c>>class.c package.c >> activity.c >> class.c

I am assembling all of these together into one application and I want activity.c to be the first activity in the stack. 我将所有这些组合在一起组成一个应用程序,我希望activity.c成为堆栈中的第一个活动。 In other words, I want it to run first. 换句话说,我希望它先运行。 Do I simply modify the order in the manifest? 我只是修改清单中的订单吗? What initializes the first application and what sets their corresponding order? 初始化第一个应用程序以及设置相应顺序的内容是什么? After the first activity is started can I just go back and forth with intents? 在第一个活动开始后,我可以和意图来回走动吗?

Thanks for your help! 谢谢你的帮助!

You want to use the CATEGORY_LAUNCHER intent filter on the activity you want to be launched when the application starts. 您希望对应用程序启动时要启动的活动使用CATEGORY_LAUNCHER intent过滤器。

From the documentation : 从文档

CATEGORY_LAUNCHER The activity can be the initial activity of a task and is listed in the top-level application launcher. CATEGORY_LAUNCHER活动可以是任务的初始活动,并列在顶级应用程序启动器中。

Once the application is started, you can move back and forth using intents. 应用程序启动后,您可以使用意图来回移动。

You need to set your activity C with this intent filter : 您需要使用此intent filter设置活动C:

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

This way that will be the only activity launched from the home screen. 这种方式将是从主屏幕启动的唯一活动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM