Tuesday, 25 November 2014

Fields of Intent in Android.

1- Component:

i)- It specifies the component to be started.
ii)- It can be set to class or fully qualified class name.

2- Context:

It is the context in which intent will be created.

i)- For Activity: Context is " this ".
ii)- For Content Provider : Context is getContext().
iii)- For Service : Context is getApplicationContext().
iv)- For Broadcast Reciever : Context will be passed as a parameter to onRecieve() method.

3- Action:

It is a String Constant which defines unique action performed by the intent ( unique by its package name ).

4- Category:

i)- It is more information about an action.
ii)- By default category is set to "android.intent.category.DEFAULT".

5- Data:

It is type of URI that supported in the component.


Browser supports " http " URI , Telephone supports " tel " URI.
* Context and Component are used for Explicit Intent and Remaining feilds are used for Implicit intent.

No comments:

Post a Comment