Joke Collection Website - Public benefit messages - Android messaging BroadCast, Handler and EventBus advantages and disadvantages
Android messaging BroadCast, Handler and EventBus advantages and disadvantages
Broadcasting is the method that consumes the most time and space. It is one of the four major components. Many system-level events are notified through broadcasts, such as changes in power, network changes, SMS reception and occurrence status, etc.
Advantages: Closely connected with SDK, very convenient when you need to interact with Android. And cross-process communication can be achieved. Activity can be started when necessary
Disadvantages: It takes up a lot of resources and needs to rely on Context
Handlers are generally used for inter-thread communication. The handler's definition class and internal class are bound, which results in high coupling between event publishers and receivers. The most obvious advantage of using handlers is that when a problem occurs, it can be located very clearly and quickly.
The advantage of eventbus is that it is flexible in scheduling, does not need to rely on Context, and does not have coupling like Handler. Inheritability, priority, and stickiness are the biggest advantages of EventBus over BroadCast and observers. The disadvantages are also obvious. Event distribution in EventBus is determined by the parameter type of the annotation function, which makes it difficult to sort out the message flow when there are too many receivers or the same parameters.
- Previous article:Received a short message from CCB, 57 yuan
- Next article:How to say Happy New Year in different languages?
- Related articles
- How many words can I enter in the option of "Send SMS notification to payee" in ICBC's personal online banking transfer and remittance function?
- How to check the traffic on the mobile phone? 10086 can't be found. Is it free to call 10086?
- How to change SMS ringtone on iphone4s (jailbroken)
- How to check the electricity account number?
- Thank you for writing 800 words.
- Does the man who sent you a message on Valentine's Day care about you?
- How to use Unicom SMS business hall?
- Is there a charge for being bombarded by text messages?
- How to subscribe to 10627997 mobile newspaper?
- How does Beijing Mobile open the flow refueling package or superposition package by SMS?