one, multi-threaded1) This chapter first introduces the multi-threaded programming of Android, which shows that if you want to modify the UI in a child thread, it must be implemented by handler, Message, MessageQueue, Looper, but it is too troublesome after all.2) and then give the Asynctask, by inheriting this class, you can directly modify the UI elements in his, a lot of convenience;
Second, the service1) First give the general method of service, such as Create OnCreate, start Onstartcommand, stop OnStop, destroy ondestroy;2, then explain how activity and service communicate, Here to use a binder and serviceconnection two abstract class, of course, the activity of Bindservice, Unbindservice method, 3) wiring to put forward the concept of front-desk service, this is really a lot of programs are now in use , in fact, the implementation is very simple, is the use of our system in the eighth chapter of the notification notification, and then call Setforeground (XXXX) to achieve; 4) immediately after Intentservice appeared; in fact, the beginning of the author raised a question, Do not be confused by the name of the background service, in fact, the service is running in the main thread, so if you do very time-consuming things in the main thread will be very card, will appear ANR, so we still have to consider the use of real background services, that is intentservice.
Finally, the author gives a complete example, in the example, the author does not use the Intentservice, but uses the Service+asynctask way, I can consider using Intentservice to rewrite This example later.
Android: Tenth chapter, silent laborer in the background--service, study notes