Details of Intent and IntentFilter

When I was writing Bluetooth development today, I looked for articles on the Internet, and found that everyone's code is still a little different. So

What is the difference between Intent and IntentFilter?

1. Intent provides a consistent programming model for component startup. Whether the component you want to start is Activity, Service, or BroadcastReceiver, you can use Intent to encapsulate the startup intent.

2. At some point, the application just wants to start a component with a certain characteristic, and does not want to be coupled with a specific component. Using Intent can easily achieve the purpose of this high-level decoupling.

The IntentFilter class represents an Intent filter. In most cases, each component will define one or more IntentFilters to indicate the Intent that it can handle.  That is, the IntentFilter has more filters. Generally used for dynamic registration broadcast

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326819907&siteId=291194637