I am working on an Android project in which I need to upload some images to a GridView. Images may be in the cache if there is no cache, and then request an Internet server. My project is to use two threads to complete a download task. One thread to read the cache and one thread to load. Thus, there are 3 threads, including the user interface. Each of them has its own message queue and uses a handler for communication.
My question is: should I use a related service in this situation? Actually, I understood the project above, and it seems like nothing bad, but the GC works very hard, which can be done from the logarithm.
Another problem is that there are multiple threads when I use DDMS to monitor threads. This is due to the fact that the same loading mechanism is used in several actions. I let the threads exit the message loop when onPause () is called, I'm sure that only two of them come to life at the same time. But I see everyone in DDMS. (By the way, why do threads still exist? I allowed thread = null;)
So, in a word, my question is: can this download task benefit from a related service?
source share