28 Nov 2012


Intent Object in an Android.

It is a bundle of information contains information for components that receives the intent like action to be taken,data to be act upon, category of information that should handle the intent,and instruction to launch the target activity.And has following thing:
  • Component name- Describe the name of components that handle the intent although it is optional.The field is ComponentName object,a combination of fully qualified class name with target components and a package name set in the manifest file. of application where components reside.The components are set bysetComponent(),setClass(),setClassName(), and read by getComponent(). if component name is set the intent is delivered to an components otherwise i uses intent resolution.
  • Action-a string tells the action to be performed or action to be reported.  example,  ACTION_CALL which has a target components Activity has action " initaite the phone call".The action determine how the rest of intent is structured that is data andextra field.It is set by set by setAction(), and read by getAction().
  • Data-it contain two thing URI and MIME.  URI indicates where data is located on the device and MIME tells the type of data.setData(),setType().setDataType() are used for setting data and type where as getData() and getType() are used for getting data and Type.
  • Category-string contain extra information about the components that handle the intent. Eg,  CATEGORY_HOME activity displays the home screen.getCategories()is used for getting the category information.
  • Extras-provides the extra information that should given the components which handles the intent.

No comments:

Post a Comment

Translate