What are Intent Filters exactly?

后端 未结 7 1618
我寻月下人不归
我寻月下人不归 2021-02-04 02:31

I\'ve read lots of articles about intent filters and I really can\'t understand exactly what they do?

so please if anybody can explain to me with a clear example what is

7条回答
  •  北海茫月
    2021-02-04 03:27

    intentFilters advertise the capabilities of a component and delimit the intents that can handle. an IntentFilter that a given Activity, Service or BroadcastReceiver will respond to a combination of action, data mime type, scheme, path, etc.

    The intent by comparing the intent to intent filters based on three aspects:

    1:- The intent action
    2:- The intent data (both URI and data type)
    3:- The intent category

    action :
    Declares the intent action accepted, in the name attribute. The value must be the literal string value of an action, not the class constant.

    data :
    Declares the type of data accepted, using one or more attributes that specify various aspects of the data URI (scheme, host, port, path, etc.) and MIME type.

    category :
    Declares the intent category accepted, in the name attribute. The value must be the literal string value of an action, not the class constant.

    For example, This activity handles "SEND" actions with text data.

    
        
        
        
    
    

提交回复
热议问题