Can you do two things at the same time?

What I have is an activity with a more serious and another action with other information about it. However, when I open non-market activity, the terminal closes. Is there a way I can stop this? If you need to see any code, I would be happy to show it.

+4
source share
2 answers

You cannot run multiple actions at the same time. If you want the code to run in the background, you need to use Service . For more information check the docs: http://developer.android.com/reference/android/app/Service.html

You must program your server as a Service , and then write an Activity that communicates with the server and displays the relevant information. Thus, when moving to a new Activity server continues to work.

+9
source

Can two actions be performed simultaneously?

Not in the sense of what you expect. In Android operations, they are stored on the stack, only the top of the stack is displayed on the screen. While other activities that are not at the top are not necessarily completely β€œdead”, they are not alive enough to do the job for you.

Instead, you should make your server in the service.

+1
source

All Articles