Four components
activity
Direct translation: activities, that is, you can see the interface of the object, should be considered activity.
It is implemented by fragment or View (control) padding. A form interface similar to computer software.
The mouse click event of the form interface, in activity, is the click event of the finger, but the finger can do more, that is, the activity can respond to a variety of operations. (Point, long Press, double-click, drag, etc.)
each activity has its own life cycle, and like people, there are times when they are born, when they are used, when there is a pause (sickness), when there is recovery, and of course there is death and destruction (cremation). In different times, activity corresponds to do the corresponding things, such as: birth is just to create a new life, it can not do anything, grow up to be able to deal with some things. The
contentprovider
Content provider, which is the equivalent of a cloud space, can get the content in it or put it in the cloud.
This allows you to save a lot of space without having to build a database on your own, while eliminating the fact that the same type of data cannot be found in different software. The
broadcastreceiver
Broadcast, which is the speaker of the phone, can be placed outside the voice, can also be heard with the ear. The
out-of-band voice is anyone can hear, who can handle (of course, there are some special places)
with the ears to listen, you can only hear themselves, send themselves to broadcast, their own broadcast, their own processing. What is the benefit of the
? When there is news, do not have a notice, who to deal with, who deal with go.
If it's my own news, you can order it, and I'll deal with it naturally.
Service
Services, which are code that runs in the background, are not displayed in the interface.
There was a doubt that the songs running in the background didn't have a notification bar display? In fact, that is just the notification bar interface, and service does not matter, not the interface can also play songs. The
service is a bit like a human brain, you can't see it's counting things, but it can design things in the brain, do all kinds of complex calculations, and you can dream all night.
But the brain is not for no reason to start the operation, but to have a certain trigger conditions, such as seeing something, what happened, and so on, the service is the same, must be a thing to trigger it to start, and tell the program when I finished, and then return a result.