Wednesday, February 5, 2014

The service and android UI thread with thread, why not write the code directly in the activity


            
The service and android UI thread with the thread, so why deliberately put forward a service, directly to the code written in the activity is not enough. Such as playing MP3, write the code inside the event listener is not the same as it
Reply:
service is a task running in the background, invisible.

actvity if not visible. Gc in the recovery, low priority, the system can easily be recovered out. However, the high priority service. To ensure long-term operation in the background.
Reply:
Agree 1L
In addition, according to a modular design idea, it is still a separate module, low coupling Well
If more than one activity to the same call using a service, is it still there, they are written in each activity over service
Reply:
There are a lot of points with a JAva Andorid design patterns
Relationship that relationship Activity, Service, Provider somewhat similar in the JAVA JavaScript, JavaBean, Servlet's
Reply:
Top 1,2 F
Reply:
1,2,3 floor, grasp wanted to say it! Hey
Reply:
reference to the third floor wenzheng38 reply:
a little Andorid JAva many have adopted the design patterns
Relationship that Activity, Service, Provider JAVA somewhat similar in the JavaScript, JavaBean, Servlet's relationship
is the legendary MVC design pattern it, but feel the relationship of the four components of MVC it ​​can not meet that android in mvc how to explain, please advice?
Reply:
I also think this issue. service and UI are not in the same thread as well?
Reply:
Since the Service is not in a separate thread, then why can access the network in the Service as well?
(3.0 later versions also possible)

No comments:

Post a Comment