When you create an Activity in onCreate (), Servce starts. Service periodically reborn, after the system will beat it. In Service, a new thread is created (implements Runnable). The problem is that the stream should be in 1 copy. How can I check if there is a stream of a certain class, and if not, then start, and vice versa, if there is not creating a stream?

UPD: There is a thought to make a pool of threads. But it is still difficult for me, can it be made easier? Control 1 thread.

  • Make the flow class a singleton. - dzukp

0