(新手)设计决策。链接活动更好还是从服务调用它们更好
我正在实现一个游戏,其中许多玩家必须完成多个级别(每个级别的游戏时间非常短)
从逻辑上讲:
for (l = 1; l <= num_levels; l++)
{
for (p = 1; p <= num_players; p++)
{
PLAY (l, p);
}
}
有 2 个可用选项
- 将活动链接到活动
- 实现一个服务,其中为每个级别/玩家迭代调用 startActivityForResult () (显然,主应用程序循环将在主线程以外的线程中运行)。
根据已经实施这种“模式”的人的经验,哪种解决方案是最好的,为什么?
非常感谢。
保罗
I am implementing a game in which many players have to complete several levels (very short playing time per level)
Logically speaking :
for (l = 1; l <= num_levels; l++)
{
for (p = 1; p <= num_players; p++)
{
PLAY (l, p);
}
}
There are 2 options available
- Chain Activiity to Activity
- Implement a Service in which startActivityForResult () is called for each Level/Player iteration (obviously the main app loop would run in a thread other than the main thread).
Based on experience from those who have already implemented such a "pattern", which solution is best and why ??
Many tnhanks.
Paul
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我了解您想要完成的任务,从服务启动活动并不是一个好主意。我认为很少有这样的情况。
您可以在一项活动中完成这一切。只需让它迭代这两个列表(级别和玩家)并采取相应的行动即可。
From what I understand what you want to accomplish, it would not be a good idea to start Activities from a service. I think it rarely ever is.
You could do this all in one Activity. Just have it iterate over those two Lists (Levels and Players) and act accordingly.