可以有两个活动同时运行? [英] Can you have two activities running at the same time?
问题描述
我有什么是活动与严厉,并与它不同的信息,另一个活动。然而,当我打开非SEVER活动断绝关闭。有没有一种办法,我能得到这个停下来?如果你需要看到任何code我会很高兴地表现出来。
What I have is an activity with a severer, and another activity with different information on it. However when I open the non-sever activity the sever closes. Is there a way that I can get this to stop? If you need to see any code I would be happy to show it.
推荐答案
您不能在同一时间运行多个活动。如果你想code在后台运行,你需要使用服务
。欲了解更多信息,签出的文档: http://developer.android.com/reference/安卓/ APP / Service.html
You cannot have multiple activities running at the same time. If you want code to run in the background you need to use a Service
. For more information checkout the docs: http://developer.android.com/reference/android/app/Service.html
您应该设定您的服务器作为服务
,然后写一个活动
与服务器和相关的显示器通信信息。这样一来,当你浏览到一个新的活动
服务器继续运行。
You should program your server as a Service
and then write an Activity
that communicates with the server and displays relevant information. This way when you navigate to a new Activity
the server continues to run.
这篇关于可以有两个活动同时运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!