core/java/android/content/Intent.java - platform/frameworks/base

文章推薦指數: 80 %
投票人數:10人

* defined in the Intent class, but applications can also define their own. * These strings use java style scoping, to ensure they are unique -- for. * example, ... android/platform/frameworks/base/135936072b24b090fb63940aea41b408d855a4f3/./core/java/android/content/Intent.javablob:24c2461c67870e1bb5ee9404b6c44742654a0977[file][log][blame]/**Copyright(C)2006TheAndroidOpenSourceProject**LicensedundertheApacheLicense,Version2.0(the"License");*youmaynotusethisfileexceptincompliancewiththeLicense.*YoumayobtainacopyoftheLicenseat**http://www.apache.org/licenses/LICENSE-2.0**Unlessrequiredbyapplicablelaworagreedtoinwriting,software*distributedundertheLicenseisdistributedonan"ASIS"BASIS,*WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.*SeetheLicenseforthespecificlanguagegoverningpermissionsand*limitationsundertheLicense.*/packageandroid.content;importorg.xmlpull.v1.XmlPullParser;importorg.xmlpull.v1.XmlPullParserException;importandroid.annotation.SdkConstant;importandroid.annotation.SdkConstant.SdkConstantType;importandroid.content.pm.ActivityInfo;importandroid.content.pm.PackageManager;importandroid.content.pm.ResolveInfo;importandroid.content.res.Resources;importandroid.content.res.TypedArray;importandroid.graphics.Rect;importandroid.net.Uri;importandroid.os.Bundle;importandroid.os.IBinder;importandroid.os.Parcel;importandroid.os.Parcelable;importandroid.util.AttributeSet;importandroid.util.Log;importcom.android.internal.util.XmlUtils;importjava.io.IOException;importjava.io.Serializable;importjava.net.URISyntaxException;importjava.util.ArrayList;importjava.util.HashSet;importjava.util.Iterator;importjava.util.Locale;importjava.util.Set;/***Anintentisanabstractdescriptionofanoperationtobeperformed.It*canbeusedwith{@linkContext#startActivity(Intent)startActivity}to*launchan{@linkandroid.app.Activity},*{@linkandroid.content.Context#sendBroadcast(Intent)broadcastIntent}to*sendittoanyinterested{@linkBroadcastReceiverBroadcastReceiver}components,*and{@linkandroid.content.Context#startService}or*{@linkandroid.content.Context#bindService}tocommunicatewitha*background{@linkandroid.app.Service}.**

AnIntentprovidesafacilityforperforminglateruntimebindingbetweenthecodein*differentapplications.Itsmostsignificantuseisinthelaunchingofactivities,whereit*canbethoughtofasthegluebetweenactivities.Itisbasicallyapassivedatastructure*holdinganabstractdescriptionofanactiontobeperformed.

***

DeveloperGuides

*

Forinformationabouthowtocreateandresolveintents,readthe*IntentsandIntentFilters*developerguide.

****

IntentStructure

*

Theprimarypiecesofinformationinanintentare:

**
    *
  • action--Thegeneralactiontobeperformed,suchas*{@link#ACTION_VIEW},{@link#ACTION_EDIT},{@link#ACTION_MAIN},*etc.

    *
  • *
  • data--Thedatatooperateon,suchasapersonrecord*inthecontactsdatabase,expressedasa{@linkandroid.net.Uri}.

    *
  • *
***

Someexamplesofaction/datapairsare:

**
    *
  • {@link#ACTION_VIEW}content://contacts/people/1--Display*informationaboutthepersonwhoseidentifieris"1".

    *
  • *
  • {@link#ACTION_DIAL}content://contacts/people/1--Display*thephonedialerwiththepersonfilledin.

    *
  • *
  • {@link#ACTION_VIEW}tel:123--Display*thephonedialerwiththegivennumberfilledin.Notehowthe*VIEWactiondoeswhatwhatisconsideredthemostreasonablethingfor*aparticularURI.

    *
  • *
  • {@link#ACTION_DIAL}tel:123--Display*thephonedialerwiththegivennumberfilledin.

    *
  • *
  • {@link#ACTION_EDIT}content://contacts/people/1--Edit*informationaboutthepersonwhoseidentifieris"1".

    *
  • *
  • {@link#ACTION_VIEW}content://contacts/people/--Display*alistofpeople,whichtheusercanbrowsethrough.Thisexampleisa*typicaltop-levelentryintotheContactsapplication,showingyouthe*listofpeople.Selectingaparticularpersontoviewwouldresultina*newintent{{@link#ACTION_VIEW}content://contacts/N}*beingusedtostartanactivitytodisplaythatperson.

    *
  • *
**

Inadditiontotheseprimaryattributes,thereareanumberofsecondary*attributesthatyoucanalsoincludewithanintent:

**
    *
  • category--Givesadditionalinformationabouttheaction*toexecute.Forexample,{@link#CATEGORY_LAUNCHER}meansitshould*appearintheLauncherasatop-levelapplication,while*{@link#CATEGORY_ALTERNATIVE}meansitshouldbeincludedinalist*ofalternativeactionstheusercanperformonapieceofdata.

    *
  • type--Specifiesanexplicittype(aMIMEtype)ofthe*intentdata.Normallythetypeisinferredfromthedataitself.*Bysettingthisattribute,youdisablethatevaluationandforce*anexplicittype.

    *
  • component--Specifiesanexplicitnameofacomponent*classtousefortheintent.Normallythisisdeterminedbylooking*attheotherinformationintheintent(theaction,data/type,and*categories)andmatchingthatwithacomponentthatcanhandleit.*Ifthisattributeissetthennoneoftheevaluationisperformed,*andthiscomponentisusedexactlyasis.Byspecifyingthisattribute,*alloftheotherIntentattributesbecomeoptional.

    *
  • extras--Thisisa{@linkBundle}ofanyadditionalinformation.*Thiscanbeusedtoprovideextendedinformationtothecomponent.*Forexample,ifwehaveaactiontosendane-mailmessage,wecould*alsoincludeextrapiecesofdataheretosupplyasubject,body,*etc.

    *
**

Herearesomeexamplesofotheroperationsyoucanspecifyasintents*usingtheseadditionalparameters:

**
    *
  • {@link#ACTION_MAIN}withcategory{@link#CATEGORY_HOME}--*Launchthehomescreen.

    *
  • *
  • {@link#ACTION_GET_CONTENT}withMIMEtype*{@linkandroid.provider.Contacts.Phones#CONTENT_URI*vnd.android.cursor.item/phone}*--Displaythelistofpeople'sphonenumbers,allowingtheuserto*browsethroughthemandpickoneandreturnittotheparentactivity.

    *
  • *
  • {@link#ACTION_GET_CONTENT}withMIMEtype**{@literal/}*andcategory{@link#CATEGORY_OPENABLE}*--Displayallpickersfordatathatcanbeopenedwith*{@linkContentResolver#openInputStream(Uri)ContentResolver.openInputStream()},*allowingtheusertopickoneofthemandthensomedatainsideofit*andreturningtheresultingURItothecaller.Thiscanbeused,*forexample,inane-mailapplicationtoallowtheusertopicksome*datatoincludeasanattachment.

    *
  • *
**

ThereareavarietyofstandardIntentactionandcategoryconstants*definedintheIntentclass,butapplicationscanalsodefinetheirown.*Thesestringsusejavastylescoping,toensuretheyareunique--for*example,thestandard{@link#ACTION_VIEW}iscalled*"android.intent.action.VIEW".

**

Puttogether,thesetofactions,datatypes,categories,andextradata*definesalanguageforthesystemallowingfortheexpressionofphrases*suchas"calljohnsmith'scell".Asapplicationsareaddedtothesystem,*theycanextendthislanguagebyaddingnewactions,types,andcategories,or*theycanmodifythebehaviorofexistingphrasesbysupplyingtheirown*activitiesthathandlethem.

***

IntentResolution

**

Therearetwoprimaryformsofintentsyouwilluse.**

    *
  • ExplicitIntentshavespecifiedacomponent(via*{@link#setComponent}or{@link#setClass}),whichprovidestheexact*classtoberun.Oftenthesewillnotincludeanyotherinformation,*simplybeingawayforanapplicationtolaunchvariousinternal*activitiesithasastheuserinteractswiththeapplication.**

  • ImplicitIntentshavenotspecifiedacomponent;*instead,theymustincludeenoughinformationforthesystemto*determinewhichoftheavailablecomponentsisbesttorunforthat*intent.*

**

Whenusingimplicitintents,givensuchanarbitraryintentweneedto*knowwhattodowithit.ThisishandledbytheprocessofIntent*resolution,whichmapsanIntenttoan{@linkandroid.app.Activity},*{@linkBroadcastReceiver},or{@linkandroid.app.Service}(orsometimestwoor*moreactivities/receivers)thatcanhandleit.

**

Theintentresolutionmechanismbasicallyrevolvesaroundmatchingan*Intentagainstallofthe<intent-filter>descriptionsinthe*installedapplicationpackages.(Plus,inthecaseofbroadcasts,any{@linkBroadcastReceiver}*objectsexplicitlyregisteredwith{@linkContext#registerReceiver}.)More*detailsonthiscanbefoundinthedocumentationonthe{@link*IntentFilter}class.

**

TherearethreepiecesofinformationintheIntentthatareusedfor*resolution:theaction,type,andcategory.Usingthisinformation,aquery*isdoneonthe{@linkPackageManager}foracomponentthatcanhandlethe*intent.Theappropriatecomponentisdeterminedbasedontheintent*informationsuppliedintheAndroidManifest.xmlfileas*follows:

**
    *
  • Theaction,ifgiven,mustbelistedbythecomponentas*oneithandles.

    *
  • ThetypeisretrievedfromtheIntent'sdata,ifnot*alreadysuppliedintheIntent.Liketheaction,ifatypeis*includedintheintent(eitherexplicitlyorimplicitlyinits*data),thenthismustbelistedbythecomponentasoneithandles.

    *
  • Fordatathatisnotacontent:URIandwherenoexplicit*typeisincludedintheIntent,insteadtheschemeofthe*intentdata(suchashttp:ormailto:)is*considered.Againliketheaction,ifwearematchingaschemeit*mustbelistedbythecomponentasoneitcanhandle.*
  • Thecategories,ifsupplied,mustallbelisted*bytheactivityascategoriesithandles.Thatis,ifyouinclude*thecategories{@link#CATEGORY_LAUNCHER}and*{@link#CATEGORY_ALTERNATIVE},thenyouwillonlyresolvetocomponents*withanintentthatlistsbothofthosecategories.*Activitieswillveryoftenneedtosupportthe*{@link#CATEGORY_DEFAULT}sothattheycanbefoundby*{@linkContext#startActivityContext.startActivity()}.

    *
**

Forexample,considertheNotePadsampleapplicationthat*allowsusertobrowsethroughalistofnotesdataandviewdetailsabout*individualitems.Textinitalicsindicateplaceswereyouwouldreplacea*namewithonespecifictoyourownpackage.

**
<manifestxmlns:android="http://schemas.android.com/apk/res/android"*package="com.android.notepad">*<applicationandroid:icon="@drawable/app_notes"*android:label="@string/app_name">**<providerclass=".NotePadProvider"*android:authorities="com.google.provider.NotePad"/>**<activityclass=".NotesList"android:label="@string/title_notes_list">*<intent-filter>*<actionandroid:name="android.intent.action.MAIN"/>*<categoryandroid:name="android.intent.category.LAUNCHER"/>*</intent-filter>*<intent-filter>*<actionandroid:name="android.intent.action.VIEW"/>*<actionandroid:name="android.intent.action.EDIT"/>*<actionandroid:name="android.intent.action.PICK"/>*<categoryandroid:name="android.intent.category.DEFAULT"/>*<dataandroid:mimeType="vnd.android.cursor.dir/vnd.google.note"/>*</intent-filter>*<intent-filter>*<actionandroid:name="android.intent.action.GET_CONTENT"/>*<categoryandroid:name="android.intent.category.DEFAULT"/>*<dataandroid:mimeType="vnd.android.cursor.item/vnd.google.note"/>*</intent-filter>*</activity>**<activityclass=".NoteEditor"android:label="@string/title_note">*<intent-filterandroid:label="@string/resolve_edit">*<actionandroid:name="android.intent.action.VIEW"/>*<actionandroid:name="android.intent.action.EDIT"/>*<categoryandroid:name="android.intent.category.DEFAULT"/>*<dataandroid:mimeType="vnd.android.cursor.item/vnd.google.note"/>*</intent-filter>**<intent-filter>*<actionandroid:name="android.intent.action.INSERT"/>*<categoryandroid:name="android.intent.category.DEFAULT"/>*<dataandroid:mimeType="vnd.android.cursor.dir/vnd.google.note"/>*</intent-filter>**</activity>**<activityclass=".TitleEditor"android:label="@string/title_edit_title"*android:theme="@android:style/Theme.Dialog">*<intent-filterandroid:label="@string/resolve_title">*<actionandroid:name="com.android.notepad.action.EDIT_TITLE"/>*<categoryandroid:name="android.intent.category.DEFAULT"/>*<categoryandroid:name="android.intent.category.ALTERNATIVE"/>*<categoryandroid:name="android.intent.category.SELECTED_ALTERNATIVE"/>*<dataandroid:mimeType="vnd.android.cursor.item/vnd.google.note"/>*</intent-filter>*</activity>**</application>*</manifest>
**

Thefirstactivity,*com.android.notepad.NotesList,servesasourmain*entryintotheapp.Itcandothreethingsasdescribedbyitsthreeintent*templates:*

    *
  1. *<intent-filter>*<actionandroid:name="{@link#ACTION_MAINandroid.intent.action.MAIN}"/>*<categoryandroid:name="{@link#CATEGORY_LAUNCHERandroid.intent.category.LAUNCHER}"/>*</intent-filter>
    *

    Thisprovidesatop-levelentryintotheNotePadapplication:thestandard*MAINactionisamainentrypoint(notrequiringanyotherinformationin*theIntent),andtheLAUNCHERcategorysaysthatthisentrypointshouldbe*listedintheapplicationlauncher.

    *
  2. *<intent-filter>*<actionandroid:name="{@link#ACTION_VIEWandroid.intent.action.VIEW}"/>*<actionandroid:name="{@link#ACTION_EDITandroid.intent.action.EDIT}"/>*<actionandroid:name="{@link#ACTION_PICKandroid.intent.action.PICK}"/>*<categoryandroid:name="{@link#CATEGORY_DEFAULTandroid.intent.category.DEFAULT}"/>*<datamimeType:name="vnd.android.cursor.dir/vnd.google.note"/>*</intent-filter>
    *

    Thisdeclaresthethingsthattheactivitycandoonadirectoryof*notes.Thetypebeingsupportedisgivenwiththe<type>tag,where*vnd.android.cursor.dir/vnd.google.noteisaURIfromwhich*aCursorofzeroormoreitems(vnd.android.cursor.dir)can*beretrievedwhichholdsournotepaddata(vnd.google.note).*Theactivityallowstheusertovieworeditthedirectoryofdata(via*theVIEWandEDITactions),ortopickaparticularnoteandreturnit*tothecaller(viathePICKaction).NotealsotheDEFAULTcategory*suppliedhere:thisisrequiredforthe*{@linkContext#startActivityContext.startActivity}methodtoresolveyour*activitywhenitscomponentnameisnotexplicitlyspecified.

    *
  3. *<intent-filter>*<actionandroid:name="{@link#ACTION_GET_CONTENTandroid.intent.action.GET_CONTENT}"/>*<categoryandroid:name="{@link#CATEGORY_DEFAULTandroid.intent.category.DEFAULT}"/>*<dataandroid:mimeType="vnd.android.cursor.item/vnd.google.note"/>*</intent-filter>
    *

    Thisfilterdescribestheabilityreturntothecalleranoteselectedby*theuserwithoutneedingtoknowwhereitcamefrom.Thedatatype*vnd.android.cursor.item/vnd.google.noteisaURIfromwhich*aCursorofexactlyone(vnd.android.cursor.item)itemcan*beretrievedwhichcontainsournotepaddata(vnd.google.note).*TheGET_CONTENTactionissimilartothePICKaction,wheretheactivity*willreturntoitscallerapieceofdataselectedbytheuser.Here,*however,thecallerspecifiesthetypeofdatatheydesireinsteadof*thetypeofdatatheuserwillbepickingfrom.

    *
**

Giventhesecapabilities,thefollowingintentswillresolvetothe*NotesListactivity:

**
    *
  • {action=android.app.action.MAIN}matchesallofthe*activitiesthatcanbeusedastop-levelentrypointsintoan*application.

    *
  • {action=android.app.action.MAIN,*category=android.app.category.LAUNCHER}istheactualintent*usedbytheLaunchertopopulateitstop-levellist.

    *
  • {action=android.intent.action.VIEW*data=content://com.google.provider.NotePad/notes}*displaysalistofallthenotesunder*"content://com.google.provider.NotePad/notes",which*theusercanbrowsethroughandseethedetailson.

    *
  • {action=android.app.action.PICK*data=content://com.google.provider.NotePad/notes}*providesalistofthenotesunder*"content://com.google.provider.NotePad/notes",fromwhich*theusercanpickanotewhosedataURLisreturnedbacktothecaller.

    *
  • {action=android.app.action.GET_CONTENT*type=vnd.android.cursor.item/vnd.google.note}*issimilartothepickaction,butallowsthecallertospecifythe*kindofdatatheywantbacksothatthesystemcanfindtheappropriate*activitytopicksomethingofthatdatatype.

    *
**

Thesecondactivity,*com.android.notepad.NoteEditor,showstheuserasingle*noteentryandallowsthemtoeditit.Itcandotwothingsasdescribed*byitstwointenttemplates:*

    *
  1. *<intent-filterandroid:label="@string/resolve_edit">*<actionandroid:name="{@link#ACTION_VIEWandroid.intent.action.VIEW}"/>*<actionandroid:name="{@link#ACTION_EDITandroid.intent.action.EDIT}"/>*<categoryandroid:name="{@link#CATEGORY_DEFAULTandroid.intent.category.DEFAULT}"/>*<dataandroid:mimeType="vnd.android.cursor.item/vnd.google.note"/>*</intent-filter>
    *

    Thefirst,primary,purposeofthisactivityistolettheuserinteract*withasinglenote,asdecribedbytheMIMEtype*vnd.android.cursor.item/vnd.google.note.Theactivitycan*eitherVIEWanoteorallowtheusertoEDITit.Againwesupportthe*DEFAULTcategorytoallowtheactivitytobelaunchedwithoutexplicitly*specifyingitscomponent.

    *
  2. *<intent-filter>*<actionandroid:name="{@link#ACTION_INSERTandroid.intent.action.INSERT}"/>*<categoryandroid:name="{@link#CATEGORY_DEFAULTandroid.intent.category.DEFAULT}"/>*<dataandroid:mimeType="vnd.android.cursor.dir/vnd.google.note"/>*</intent-filter>
    *

    Thesecondaryuseofthisactivityistoinsertanewnoteentryinto*anexistingdirectoryofnotes.Thisisusedwhentheusercreatesanew*note:theINSERTactionisexecutedonthedirectoryofnotes,causing*thisactivitytorunandhavetheusercreatethenewnotedatawhich*itthenaddstothecontentprovider.

    *
**

Giventhesecapabilities,thefollowingintentswillresolvetothe*NoteEditoractivity:

**
    *
  • {action=android.intent.action.VIEW*data=content://com.google.provider.NotePad/notes/{ID}}*showstheuserthecontentofnote{ID}.

    *
  • {action=android.app.action.EDIT*data=content://com.google.provider.NotePad/notes/{ID}}*allowstheusertoeditthecontentofnote{ID}.

    *
  • {action=android.app.action.INSERT*data=content://com.google.provider.NotePad/notes}*createsanew,emptynoteinthenoteslistat*"content://com.google.provider.NotePad/notes"*andallowstheusertoeditit.Iftheykeeptheirchanges,theURI*ofthenewlycreatednoteisreturnedtothecaller.

    *
**

Thelastactivity,*com.android.notepad.TitleEditor,allowstheuserto*editthetitleofanote.Thiscouldbeimplementedasaclassthatthe*applicationdirectlyinvokes(byexplicitlysettingitscomponentin*theIntent),buthereweshowawayyoucanpublishalternative*operationsonexistingdata:

**
*<intent-filterandroid:label="@string/resolve_title">*<actionandroid:name="com.android.notepad.action.EDIT_TITLE"/>*<categoryandroid:name="{@link#CATEGORY_DEFAULTandroid.intent.category.DEFAULT}"/>*<categoryandroid:name="{@link#CATEGORY_ALTERNATIVEandroid.intent.category.ALTERNATIVE}"/>*<categoryandroid:name="{@link#CATEGORY_SELECTED_ALTERNATIVEandroid.intent.category.SELECTED_ALTERNATIVE}"/>*<dataandroid:mimeType="vnd.android.cursor.item/vnd.google.note"/>*</intent-filter>
**

Inthesingleintenttemplatehere,we*havecreatedourownprivateactioncalled*com.android.notepad.action.EDIT_TITLEwhichmeansto*editthetitleofanote.Itmustbeinvokedonaspecificnote*(datatypevnd.android.cursor.item/vnd.google.note)liketheprevious*viewandeditactions,butheredisplaysandeditsthetitlecontained*inthenotedata.**

Inadditiontosupportingthedefaultcategoryasusual,ourtitleeditor*alsosupportstwootherstandardcategories:ALTERNATIVEand*SELECTED_ALTERNATIVE.Implementing*thesecategoriesallowsotherstofindthespecialactionitprovides*withoutdirectlyknowingaboutit,throughthe*{@linkandroid.content.pm.PackageManager#queryIntentActivityOptions}method,or*moreoftentobuilddynamicmenuitemswith*{@linkandroid.view.Menu#addIntentOptions}.Notethatintheintent*templateherewasalsosupplyanexplicitnameforthetemplate*(viaandroid:label="@string/resolve_title")tobettercontrol*whattheuserseeswhenpresentedwiththisactivityasanalternative*actiontothedatatheyareviewing.**

Giventhesecapabilities,thefollowingintentwillresolvetothe*TitleEditoractivity:

**
    *
  • {action=com.android.notepad.action.EDIT_TITLE*data=content://com.google.provider.NotePad/notes/{ID}}*displaysandallowstheusertoeditthetitleassociated*withnote{ID}.

    *
**

StandardActivityActions

**

ThesearethecurrentstandardactionsthatIntentdefinesforlaunching*activities(usuallythrough{@linkContext#startActivity}.Themost*important,andbyfarmostfrequentlyused,are{@link#ACTION_MAIN}and*{@link#ACTION_EDIT}.**

    *
  • {@link#ACTION_MAIN}*
  • {@link#ACTION_VIEW}*
  • {@link#ACTION_ATTACH_DATA}*
  • {@link#ACTION_EDIT}*
  • {@link#ACTION_PICK}*
  • {@link#ACTION_CHOOSER}*
  • {@link#ACTION_GET_CONTENT}*
  • {@link#ACTION_DIAL}*
  • {@link#ACTION_CALL}*
  • {@link#ACTION_SEND}*
  • {@link#ACTION_SENDTO}*
  • {@link#ACTION_ANSWER}*
  • {@link#ACTION_INSERT}*
  • {@link#ACTION_DELETE}*
  • {@link#ACTION_RUN}*
  • {@link#ACTION_SYNC}*
  • {@link#ACTION_PICK_ACTIVITY}*
  • {@link#ACTION_SEARCH}*
  • {@link#ACTION_WEB_SEARCH}*
  • {@link#ACTION_FACTORY_TEST}*
**

StandardBroadcastActions

**

ThesearethecurrentstandardactionsthatIntentdefinesforreceiving*broadcasts(usuallythrough{@linkContext#registerReceiver}ora*<receiver>taginamanifest).**

    *
  • {@link#ACTION_TIME_TICK}*
  • {@link#ACTION_TIME_CHANGED}*
  • {@link#ACTION_TIMEZONE_CHANGED}*
  • {@link#ACTION_BOOT_COMPLETED}*
  • {@link#ACTION_PACKAGE_ADDED}*
  • {@link#ACTION_PACKAGE_CHANGED}*
  • {@link#ACTION_PACKAGE_REMOVED}*
  • {@link#ACTION_PACKAGE_RESTARTED}*
  • {@link#ACTION_PACKAGE_DATA_CLEARED}*
  • {@link#ACTION_UID_REMOVED}*
  • {@link#ACTION_BATTERY_CHANGED}*
  • {@link#ACTION_POWER_CONNECTED}*
  • {@link#ACTION_POWER_DISCONNECTED}*
  • {@link#ACTION_SHUTDOWN}*
**

StandardCategories

**

Thesearethecurrentstandardcategoriesthatcanbeusedtofurther*clarifyanIntentvia{@link#addCategory}.**

    *
  • {@link#CATEGORY_DEFAULT}*
  • {@link#CATEGORY_BROWSABLE}*
  • {@link#CATEGORY_TAB}*
  • {@link#CATEGORY_ALTERNATIVE}*
  • {@link#CATEGORY_SELECTED_ALTERNATIVE}*
  • {@link#CATEGORY_LAUNCHER}*
  • {@link#CATEGORY_INFO}*
  • {@link#CATEGORY_HOME}*
  • {@link#CATEGORY_PREFERENCE}*
  • {@link#CATEGORY_TEST}*
  • {@link#CATEGORY_CAR_DOCK}*
  • {@link#CATEGORY_DESK_DOCK}*
  • {@link#CATEGORY_LE_DESK_DOCK}*
  • {@link#CATEGORY_HE_DESK_DOCK}*
  • {@link#CATEGORY_CAR_MODE}*
  • {@link#CATEGORY_APP_MARKET}*
**

StandardExtraData

**

Thesearethecurrentstandardfieldsthatcanbeusedasextradatavia*{@link#putExtra}.**

    *
  • {@link#EXTRA_ALARM_COUNT}*
  • {@link#EXTRA_BCC}*
  • {@link#EXTRA_CC}*
  • {@link#EXTRA_CHANGED_COMPONENT_NAME}*
  • {@link#EXTRA_DATA_REMOVED}*
  • {@link#EXTRA_DOCK_STATE}*
  • {@link#EXTRA_DOCK_STATE_HE_DESK}*
  • {@link#EXTRA_DOCK_STATE_LE_DESK}*
  • {@link#EXTRA_DOCK_STATE_CAR}*
  • {@link#EXTRA_DOCK_STATE_DESK}*
  • {@link#EXTRA_DOCK_STATE_UNDOCKED}*
  • {@link#EXTRA_DONT_KILL_APP}*
  • {@link#EXTRA_EMAIL}*
  • {@link#EXTRA_INITIAL_INTENTS}*
  • {@link#EXTRA_INTENT}*
  • {@link#EXTRA_KEY_EVENT}*
  • {@link#EXTRA_PHONE_NUMBER}*
  • {@link#EXTRA_REMOTE_INTENT_TOKEN}*
  • {@link#EXTRA_REPLACING}*
  • {@link#EXTRA_SHORTCUT_ICON}*
  • {@link#EXTRA_SHORTCUT_ICON_RESOURCE}*
  • {@link#EXTRA_SHORTCUT_INTENT}*
  • {@link#EXTRA_STREAM}*
  • {@link#EXTRA_SHORTCUT_NAME}*
  • {@link#EXTRA_SUBJECT}*
  • {@link#EXTRA_TEMPLATE}*
  • {@link#EXTRA_TEXT}*
  • {@link#EXTRA_TITLE}*
  • {@link#EXTRA_UID}*
**

Flags

**

ThesearethepossibleflagsthatcanbeusedintheIntentvia*{@link#setFlags}and{@link#addFlags}.See{@link#setFlags}foralist*ofallpossibleflags.*/publicclassIntentimplementsParcelable,Cloneable{//---------------------------------------------------------------------//---------------------------------------------------------------------//Standardintentactivityactions(seeactionvariable)./***ActivityAction:Startasamainentrypoint,doesnotexpectto*receivedata.*

Input:nothing*

Output:nothing*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_MAIN="android.intent.action.MAIN";/***ActivityAction:Displaythedatatotheuser.Thisisthemostcommon*actionperformedondata--itisthegenericactionyoucanuseon*apieceofdatatogetthemostreasonablethingtooccur.Forexample,*whenusedonacontactsentryitwillviewtheentry;whenusedona*mailto:URIitwillbringupacomposewindowfilledwiththeinformation*suppliedbytheURI;whenusedwithatel:URIitwillinvokethe*dialer.*

Input:{@link#getData}isURIfromwhichtoretrievedata.*

Output:nothing.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_VIEW="android.intent.action.VIEW";/***Asynonymfor{@link#ACTION_VIEW},the"standard"actionthatis*performedonapieceofdata.*/publicstaticfinalStringACTION_DEFAULT=ACTION_VIEW;/***Usedtoindicatethatsomepieceofdatashouldbeattachedtosomeother*place.Forexample,imagedatacouldbeattachedtoacontact.Itisup*totherecipienttodecidewherethedatashouldbeattached;theintent*doesnotspecifytheultimatedestination.*

Input:{@link#getData}isURIofdatatobeattached.*

Output:nothing.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_ATTACH_DATA="android.intent.action.ATTACH_DATA";/***ActivityAction:Provideexpliciteditableaccesstothegivendata.*

Input:{@link#getData}isURIofdatatobeedited.*

Output:nothing.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_EDIT="android.intent.action.EDIT";/***ActivityAction:Pickanexistingitem,orinsertanewitem,andtheneditit.*

Input:{@link#getType}isthedesiredMIMEtypeoftheitemtocreateoredit.*Theextrascancontaintypespecificdatatopassthroughtotheediting/creating*activity.*

Output:TheURIoftheitemthatwaspicked.Thismustbeacontent:*URIsothatanyreceivercanaccessit.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_INSERT_OR_EDIT="android.intent.action.INSERT_OR_EDIT";/***ActivityAction:Pickanitemfromthedata,returningwhatwasselected.*

Input:{@link#getData}isURIcontainingadirectoryofdata*(vnd.android.cursor.dir/*)fromwhichtopickanitem.*

Output:TheURIoftheitemthatwaspicked.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_PICK="android.intent.action.PICK";/***ActivityAction:Createsashortcut.*

Input:Nothing.

*

Output:AnIntentrepresentingtheshortcut.Theintentmustcontainthree*extras:SHORTCUT_INTENT(value:Intent),SHORTCUT_NAME(value:String),*andSHORTCUT_ICON(value:Bitmap)orSHORTCUT_ICON_RESOURCE*(value:ShortcutIconResource).

**@see#EXTRA_SHORTCUT_INTENT*@see#EXTRA_SHORTCUT_NAME*@see#EXTRA_SHORTCUT_ICON*@see#EXTRA_SHORTCUT_ICON_RESOURCE*@seeandroid.content.Intent.ShortcutIconResource*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_CREATE_SHORTCUT="android.intent.action.CREATE_SHORTCUT";/***ThenameoftheextrausedtodefinetheIntentofashortcut.**@see#ACTION_CREATE_SHORTCUT*/publicstaticfinalStringEXTRA_SHORTCUT_INTENT="android.intent.extra.shortcut.INTENT";/***Thenameoftheextrausedtodefinethenameofashortcut.**@see#ACTION_CREATE_SHORTCUT*/publicstaticfinalStringEXTRA_SHORTCUT_NAME="android.intent.extra.shortcut.NAME";/***Thenameoftheextrausedtodefinetheicon,asaBitmap,ofashortcut.**@see#ACTION_CREATE_SHORTCUT*/publicstaticfinalStringEXTRA_SHORTCUT_ICON="android.intent.extra.shortcut.ICON";/***Thenameoftheextrausedtodefinetheicon,asaShortcutIconResource,ofashortcut.**@see#ACTION_CREATE_SHORTCUT*@seeandroid.content.Intent.ShortcutIconResource*/publicstaticfinalStringEXTRA_SHORTCUT_ICON_RESOURCE="android.intent.extra.shortcut.ICON_RESOURCE";/***Representsashortcut/livefoldericonresource.**@seeIntent#ACTION_CREATE_SHORTCUT*@seeIntent#EXTRA_SHORTCUT_ICON_RESOURCE*@seeandroid.provider.LiveFolders#ACTION_CREATE_LIVE_FOLDER*@seeandroid.provider.LiveFolders#EXTRA_LIVE_FOLDER_ICON*/publicstaticclassShortcutIconResourceimplementsParcelable{/***Thepackagenameoftheapplicationcontainingtheicon.*/publicStringpackageName;/***Theresourcenameoftheicon,includingpackage,nameandtype.*/publicStringresourceName;/***CreatesanewShortcutIconResourceforthespecifiedcontextandresource*identifier.**@paramcontextThecontextoftheapplication.*@paramresourceIdTheresourceidenfitierfortheicon.*@returnAnewShortcutIconResourcewiththespecified'scontextpackagename*andiconresourceidenfitier.*/publicstaticShortcutIconResourcefromContext(Contextcontext,intresourceId){ShortcutIconResourceicon=newShortcutIconResource();icon.packageName=context.getPackageName();icon.resourceName=context.getResources().getResourceName(resourceId);returnicon;}/***UsedtoreadaShortcutIconResourcefromaParcel.*/publicstaticfinalParcelable.CreatorCREATOR=newParcelable.Creator(){publicShortcutIconResourcecreateFromParcel(Parcelsource){ShortcutIconResourceicon=newShortcutIconResource();icon.packageName=source.readString();icon.resourceName=source.readString();returnicon;}publicShortcutIconResource[]newArray(intsize){returnnewShortcutIconResource[size];}};/***Nospecialparcelcontents.*/publicintdescribeContents(){return0;}publicvoidwriteToParcel(Parceldest,intflags){dest.writeString(packageName);dest.writeString(resourceName);}@OverridepublicStringtoString(){returnresourceName;}}/***ActivityAction:Displayanactivitychooser,allowingtheusertopick*whattheywanttobeforeproceeding.Thiscanbeusedasanalternative*tothestandardactivitypickerthatisdisplayedbythesystemwhen*youtrytostartanactivitywithmultiplepossiblematches,withthese*differencesinbehavior:*
    *
  • Youcanspecifythetitlethatwillappearintheactivitychooser.*
  • Theuserdoesnothavetheoptiontomakeoneofthematching*activitiesapreferredactivity,andallpossibleactivitieswill*alwaysbeshownevenifoneofthemiscurrentlymarkedasthe*preferredactivity.*
*

*Thisactionshouldbeusedwhentheuserwillnaturallyexpectto*selectanactivityinordertoproceed.Anexampleifwhennottouse*itiswhentheuserclicksona"mailto:"link.Theywouldnaturally*expecttogodirectlytotheirmailapp,sostartActivity()shouldbe*calleddirectly:itwill*eitherlaunchthecurrentpreferredapp,orputupadialogallowingthe*usertopickanapptouseandoptionallymarkingthataspreferred.*

*Incontrast,iftheuserisselectingamenuitemtosendapicture*theyareviewingtosomeoneelse,therearemanydifferentthingsthey*maywanttodoatthispoint:senditthroughe-mail,uploadittoa*webservice,etc.InthiscasetheCHOOSERactionshouldbeused,to*alwayspresenttotheuseralistofthethingstheycando,witha*nicetitlegivenbythecallersuchas"Sendthisphotowith:".*

*Asaconvenience,anIntentofthisformcanbecreatedwiththe*{@link#createChooser}function.*

Input:Nodatashouldbespecified.get*Extramusthave*a{@link#EXTRA_INTENT}fieldcontainingtheIntentbeingexecuted,*andcanoptionallyhavea{@link#EXTRA_TITLE}fieldcontainingthe*titletexttodisplayinthechooser.*

Output:Dependsontheprotocolof{@link#EXTRA_INTENT}.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_CHOOSER="android.intent.action.CHOOSER";/***Conveniencefunctionforcreatinga{@link#ACTION_CHOOSER}Intent.**@paramtargetTheIntentthattheuserwillbeselectinganactivity*toperform.*@paramtitleOptionaltitlethatwillbedisplayedinthechooser.*@returnReturnanewIntentobjectthatyoucanhandto*{@linkContext#startActivity(Intent)Context.startActivity()}and*relatedmethods.*/publicstaticIntentcreateChooser(Intenttarget,CharSequencetitle){Intentintent=newIntent(ACTION_CHOOSER);intent.putExtra(EXTRA_INTENT,target);if(title!=null){intent.putExtra(EXTRA_TITLE,title);}returnintent;}/***ActivityAction:Allowtheusertoselectaparticularkindofdataand*returnit.Thisisdifferentthan{@link#ACTION_PICK}inthatherewe*justsaywhatkindofdataisdesired,notaURIofexistingdatafrom*whichtheusercanpick.AACTION_GET_CONTENTcouldallowtheuserto*createthedataasitruns(forexampletakingapictureorrecordinga*sound),letthembrowseoverthewebanddownloadthedesireddata,*etc.*

*Therearetwomainwaystousethisaction:ifyouwantaspecifickind*ofdata,suchasapersoncontact,yousettheMIMEtypetothekindof*datayouwantandlaunchitwith{@linkContext#startActivity(Intent)}.*Thesystemwillthenlaunchthebestapplicationtoselectthatkind*ofdataforyou.*

*Youmayalsobeinterestedinanyofasetoftypesofcontenttheuser*canpick.Forexample,ane-mailapplicationthatwantstoallowthe*usertoaddanattachmenttoane-mailmessagecanusethisactionto*bringupalistofallofthetypesofcontenttheusercanattach.*

*Inthiscase,youshouldwraptheGET_CONTENTintentwithachooser*(through{@link#createChooser}),whichwillgivetheproperinterface*fortheusertopickhowtosendyourdataandallowyoutospecify*apromptindicatingwhattheyaredoing.Youwillusuallyspecifya*broadMIMEtype(suchasimage/*or{@literal*}/*),resultingina*broadrangeofcontenttypestheusercanselectfrom.*

*WhenusingsuchabroadGET_CONTENTaction,itisoftendesirableto*onlypickfromdatathatcanberepresentedasastream.Thisis*accomplishedbyrequiringthe{@link#CATEGORY_OPENABLE}intheIntent.*

*Callerscanoptionallyspecify{@link#EXTRA_LOCAL_ONLY}torequestthat*thelaunchedcontentchooseronlyreturnsresultsrepresentingdatathat*islocallyavailableonthedevice.Forexample,ifthisextraisset*totruethenanimagepickershouldnotshowanypicturesthatareavailable*fromaremoteserverbutnotalreadyonthelocaldevice(thusrequiring*theybedownloadedwhenopened).*

*Input:{@link#getType}isthedesiredMIMEtypetoretrieve.Note*thatnoURIissuppliedintheintent,astherearenoconstraintson*wherethereturneddataoriginallycomesfrom.Youmayalsoincludethe*{@link#CATEGORY_OPENABLE}ifyoucanonlyacceptdatathatcanbe*openedasastream.Youmayuse{@link#EXTRA_LOCAL_ONLY}tolimitcontent*selectiontolocaldata.*

*Output:TheURIoftheitemthatwaspicked.Thismustbeacontent:*URIsothatanyreceivercanaccessit.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_GET_CONTENT="android.intent.action.GET_CONTENT";/***ActivityAction:Dialanumberasspecifiedbythedata.Thisshowsa*UIwiththenumberbeingdialed,allowingtheusertoexplicitly*initiatethecall.*

Input:Ifnothing,anemptydialerisstarted;else{@link#getData}*isURIofaphonenumbertobedialedoratel:URIofanexplicitphone*number.*

Output:nothing.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_DIAL="android.intent.action.DIAL";/***ActivityAction:Performacalltosomeonespecifiedbythedata.*

Input:Ifnothing,anemptydialerisstarted;else{@link#getData}*isURIofaphonenumbertobedialedoratel:URIofanexplicitphone*number.*

Output:nothing.**

Note:therewillberestrictionsonwhichapplicationscaninitiatea*call;mostapplicationsshouldusethe{@link#ACTION_DIAL}.*

Note:thisIntentcannotbeusedtocallemergency*numbers.Applicationscandialemergencynumbersusing*{@link#ACTION_DIAL},however.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_CALL="android.intent.action.CALL";/***ActivityAction:Performacalltoanemergencynumberspecifiedbythe*data.*

Input:{@link#getData}isURIofaphonenumbertobedialedora*tel:URIofanexplicitphonenumber.*

Output:nothing.*@hide*/publicstaticfinalStringACTION_CALL_EMERGENCY="android.intent.action.CALL_EMERGENCY";/***Activityaction:Performacalltoanynumber(emergencyornot)*specifiedbythedata.*

Input:{@link#getData}isURIofaphonenumbertobedialedora*tel:URIofanexplicitphonenumber.*

Output:nothing.*@hide*/publicstaticfinalStringACTION_CALL_PRIVILEGED="android.intent.action.CALL_PRIVILEGED";/***ActivityAction:Sendamessagetosomeonespecifiedbythedata.*

Input:{@link#getData}isURIdescribingthetarget.*

Output:nothing.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_SENDTO="android.intent.action.SENDTO";/***ActivityAction:Deliversomedatatosomeoneelse.Whothedatais*beingdeliveredtoisnotspecified;itisuptothereceiverofthis*actiontoasktheuserwherethedatashouldbesent.*

*WhenlaunchingaSENDintent,youshouldusuallywrapitinachooser*(through{@link#createChooser}),whichwillgivetheproperinterface*fortheusertopickhowtosendyourdataandallowyoutospecify*apromptindicatingwhattheyaredoing.*

*Input:{@link#getType}istheMIMEtypeofthedatabeingsent.*get*Extracanhaveeithera{@link#EXTRA_TEXT}*or{@link#EXTRA_STREAM}field,containingthedatatobesent.If*usingEXTRA_TEXT,theMIMEtypeshouldbe"text/plain";otherwiseit*shouldbetheMIMEtypeofthedatainEXTRA_STREAM.Use{@literal*}/**iftheMIMEtypeisunknown(thiswillonlyallowsendersthatcan*handlegenericdatastreams).*

*Optionalstandardextras,whichmaybeinterpretedbysomerecipientsas*appropriate,are:{@link#EXTRA_EMAIL},{@link#EXTRA_CC},*{@link#EXTRA_BCC},{@link#EXTRA_SUBJECT}.*

*Output:nothing.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_SEND="android.intent.action.SEND";/***ActivityAction:Delivermultipledatatosomeoneelse.*

*LikeACTION_SEND,exceptthedataismultiple.*

*Input:{@link#getType}istheMIMEtypeofthedatabeingsent.*get*ArrayListExtracanhaveeithera{@link#EXTRA_TEXT}or{@link*#EXTRA_STREAM}field,containingthedatatobesent.*

*Multipletypesaresupported,andreceiversshouldhandlemixedtypes*wheneverpossible.Therightwayforthereceivertocheckthemisto*usethecontentresolveroneachURI.Theintentsendershouldtryto*putthemostconcretemimetypeintheintenttype,butitcanfall*backto{@literal/*}or{@literal*}/*asneeded.*

*e.g.ifyouaresendingimage/jpgandimage/jpg,theintent'stypecan*beimage/jpg,butifyouaresendingimage/jpgandimage/png,thenthe*intent'stypeshouldbeimage/*.*

*Optionalstandardextras,whichmaybeinterpretedbysomerecipientsas*appropriate,are:{@link#EXTRA_EMAIL},{@link#EXTRA_CC},*{@link#EXTRA_BCC},{@link#EXTRA_SUBJECT}.*

*Output:nothing.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_SEND_MULTIPLE="android.intent.action.SEND_MULTIPLE";/***ActivityAction:Handleanincomingphonecall.*

Input:nothing.*

Output:nothing.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_ANSWER="android.intent.action.ANSWER";/***ActivityAction:Insertanemptyitemintothegivencontainer.*

Input:{@link#getData}isURIofthedirectory(vnd.android.cursor.dir/*)*inwhichtoplacethedata.*

Output:URIofthenewdatathatwascreated.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_INSERT="android.intent.action.INSERT";/***ActivityAction:Createanewiteminthegivencontainer,initializingit*fromthecurrentcontentsoftheclipboard.*

Input:{@link#getData}isURIofthedirectory(vnd.android.cursor.dir/*)*inwhichtoplacethedata.*

Output:URIofthenewdatathatwascreated.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_PASTE="android.intent.action.PASTE";/***ActivityAction:Deletethegivendatafromitscontainer.*

Input:{@link#getData}isURIofdatatobedeleted.*

Output:nothing.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_DELETE="android.intent.action.DELETE";/***ActivityAction:Runthedata,whateverthatmeans.*

Input:?(Note:thisiscurrentlyspecifictothetestharness.)*

Output:nothing.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_RUN="android.intent.action.RUN";/***ActivityAction:Performadatasynchronization.*

Input:?*

Output:?*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_SYNC="android.intent.action.SYNC";/***ActivityAction:Pickanactivitygivenanintent,returningtheclass*selected.*

Input:get*Extrafield{@link#EXTRA_INTENT}isanIntent*usedwith{@linkPackageManager#queryIntentActivities}todeterminethe*setofactivitiesfromwhichtopick.*

Output:Classnameoftheactivitythatwasselected.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_PICK_ACTIVITY="android.intent.action.PICK_ACTIVITY";/***ActivityAction:Performasearch.*

Input:{@linkandroid.app.SearchManager#QUERYgetStringExtra(SearchManager.QUERY)}*isthetexttosearchfor.Ifempty,simply*enteryoursearchresultsActivitywiththesearchUIactivated.*

Output:nothing.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_SEARCH="android.intent.action.SEARCH";/***ActivityAction:Starttheplatform-definedtutorial*

Input:{@linkandroid.app.SearchManager#QUERYgetStringExtra(SearchManager.QUERY)}*isthetexttosearchfor.Ifempty,simply*enteryoursearchresultsActivitywiththesearchUIactivated.*

Output:nothing.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_SYSTEM_TUTORIAL="android.intent.action.SYSTEM_TUTORIAL";/***ActivityAction:Performawebsearch.*

*Input:{@linkandroid.app.SearchManager#QUERY*getStringExtra(SearchManager.QUERY)}isthetexttosearchfor.Ifitis*aurlstartswithhttporhttps,thesitewillbeopened.Ifitisplain*text,Googlesearchwillbeapplied.*

*Output:nothing.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_WEB_SEARCH="android.intent.action.WEB_SEARCH";/***ActivityAction:Listallavailableapplications*

Input:Nothing.*

Output:nothing.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_ALL_APPS="android.intent.action.ALL_APPS";/***ActivityAction:Showsettingsforchoosingwallpaper*

Input:Nothing.*

Output:Nothing.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_SET_WALLPAPER="android.intent.action.SET_WALLPAPER";/***ActivityAction:Showactivityforreportingabug.*

Input:Nothing.*

Output:Nothing.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_BUG_REPORT="android.intent.action.BUG_REPORT";/***ActivityAction:Mainentrypointforfactorytests.Onlyusedwhen*thedeviceisbootinginfactorytestnode.Theimplementingpackage*mustbeinstalledinthesystemimage.*

Input:nothing*

Output:nothing*/publicstaticfinalStringACTION_FACTORY_TEST="android.intent.action.FACTORY_TEST";/***ActivityAction:Theuserpressedthe"call"buttontogotothedialer*orotherappropriateUIforplacingacall.*

Input:Nothing.*

Output:Nothing.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_CALL_BUTTON="android.intent.action.CALL_BUTTON";/***ActivityAction:StartVoiceCommand.*

Input:Nothing.*

Output:Nothing.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_VOICE_COMMAND="android.intent.action.VOICE_COMMAND";/***ActivityAction:Startactionassociatedwithlongpressingonthe*searchkey.*

Input:Nothing.*

Output:Nothing.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_SEARCH_LONG_PRESS="android.intent.action.SEARCH_LONG_PRESS";/***ActivityAction:Theuserpressedthe"Report"buttoninthecrash/ANRdialog.*Thisintentisdeliveredtothepackagewhichinstalledtheapplication,usually*GooglePlay.*

Input:Nodataisspecified.Thebugreportispassedinusing*an{@link#EXTRA_BUG_REPORT}field.*

Output:Nothing.**@see#EXTRA_BUG_REPORT*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_APP_ERROR="android.intent.action.APP_ERROR";/***ActivityAction:Showpowerusageinformationtotheuser.*

Input:Nothing.*

Output:Nothing.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_POWER_USAGE_SUMMARY="android.intent.action.POWER_USAGE_SUMMARY";/***ActivityAction:Setupwizardtolaunchafteraplatformupdate.This*activityshouldhaveastringmeta-datafieldassociatedwithit,*{@link#METADATA_SETUP_VERSION},whichdefinesthecurrentversionof*theplatformforsetup.Theactivitywillbelaunchedonlyif*{@linkandroid.provider.Settings.Secure#LAST_SETUP_SHOWN}isnotthe*samevalue.*

Input:Nothing.*

Output:Nothing.*@hide*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_UPGRADE_SETUP="android.intent.action.UPGRADE_SETUP";/***ActivityAction:Showsettingsformanagingnetworkdatausageofa*specificapplication.Applicationsshoulddefineanactivitythatoffers*optionstocontroldatausage.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_MANAGE_NETWORK_USAGE="android.intent.action.MANAGE_NETWORK_USAGE";/***ActivityAction:Launchapplicationinstaller.*

*Input:Thedatamustbeacontent:orfile:URIatwhichtheapplication*canberetrieved.Youcanoptionallysupply*{@link#EXTRA_INSTALLER_PACKAGE_NAME},{@link#EXTRA_NOT_UNKNOWN_SOURCE},*{@link#EXTRA_ALLOW_REPLACE},and{@link#EXTRA_RETURN_RESULT}.*

*Output:If{@link#EXTRA_RETURN_RESULT},returnswhethertheinstall*succeeded.**@see#EXTRA_INSTALLER_PACKAGE_NAME*@see#EXTRA_NOT_UNKNOWN_SOURCE*@see#EXTRA_RETURN_RESULT*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_INSTALL_PACKAGE="android.intent.action.INSTALL_PACKAGE";/***Usedasastringextrafieldwith{@link#ACTION_INSTALL_PACKAGE}toinstalla*package.Specifiestheinstallerpackagename;thispackagewillreceivethe*{@link#ACTION_APP_ERROR}intent.*/publicstaticfinalStringEXTRA_INSTALLER_PACKAGE_NAME="android.intent.extra.INSTALLER_PACKAGE_NAME";/***Usedasabooleanextrafieldwith{@link#ACTION_INSTALL_PACKAGE}toinstalla*package.Specifiesthattheapplicationbeinginstalledshouldnotbe*treatedascomingfromanunknownsource,butascomingfromtheapp*invokingtheIntent.Forthistoworkyoumuststarttheinstallerwith*startActivityForResult().*/publicstaticfinalStringEXTRA_NOT_UNKNOWN_SOURCE="android.intent.extra.NOT_UNKNOWN_SOURCE";/***Usedasabooleanextrafieldwith{@link#ACTION_INSTALL_PACKAGE}toinstalla*package.TellstheinstallerUItoskiptheconfirmationwiththeuser*ifthe.apkisreplacinganexistingone.*/publicstaticfinalStringEXTRA_ALLOW_REPLACE="android.intent.extra.ALLOW_REPLACE";/***Usedasabooleanextrafieldwith{@link#ACTION_INSTALL_PACKAGE}or*{@link#ACTION_UNINSTALL_PACKAGE}.SpecifiesthattheinstallerUIshould*returntotheapplicationtheresultcodeoftheinstall/uninstall.Thereturnedresult*codewillbe{@linkandroid.app.Activity#RESULT_OK}onsuccessor*{@linkandroid.app.Activity#RESULT_FIRST_USER}onfailure.*/publicstaticfinalStringEXTRA_RETURN_RESULT="android.intent.extra.RETURN_RESULT";/***Packagemanagerinstallresultcode.@hidebecauseresultcodesarenot*yetreadytobeexposed.*/publicstaticfinalStringEXTRA_INSTALL_RESULT="android.intent.extra.INSTALL_RESULT";/***ActivityAction:Launchapplicationuninstaller.*

*Input:Thedatamustbeapackage:URIwhoseschemespecificpartis*thepackagenameofthecurrentinstalledpackagetobeuninstalled.*Youcanoptionallysupply{@link#EXTRA_RETURN_RESULT}.*

*Output:If{@link#EXTRA_RETURN_RESULT},returnswhethertheinstall*succeeded.*/@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)publicstaticfinalStringACTION_UNINSTALL_PACKAGE="android.intent.action.UNINSTALL_PACKAGE";/***Astringassociatedwitha{@link#ACTION_UPGRADE_SETUP}activity*describingthelastrunversionoftheplatformthatwassetup.*@hide*/publicstaticfinalStringMETADATA_SETUP_VERSION="android.SETUP_VERSION";//---------------------------------------------------------------------//---------------------------------------------------------------------//Standardintentbroadcastactions(seeactionvariable)./***BroadcastAction:Sentafterthescreenturnsoff.**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_SCREEN_OFF="android.intent.action.SCREEN_OFF";/***BroadcastAction:Sentafterthescreenturnson.**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_SCREEN_ON="android.intent.action.SCREEN_ON";/***BroadcastAction:Sentwhentheuserispresentafterdevicewakesup(e.gwhenthe*keyguardisgone).**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_USER_PRESENT="android.intent.action.USER_PRESENT";/***BroadcastAction:Thecurrenttimehaschanged.Sentevery*minute.Youcannotreceivethisthroughcomponentsdeclared*inmanifests,onlybyexlicitlyregisteringforitwith*{@linkContext#registerReceiver(BroadcastReceiver,IntentFilter)*Context.registerReceiver()}.**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_TIME_TICK="android.intent.action.TIME_TICK";/***BroadcastAction:Thetimewasset.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_TIME_CHANGED="android.intent.action.TIME_SET";/***BroadcastAction:Thedatehaschanged.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_DATE_CHANGED="android.intent.action.DATE_CHANGED";/***BroadcastAction:Thetimezonehaschanged.Theintentwillhavethefollowingextravalues:

*
    *
  • time-zone-Thejava.util.TimeZone.getID()valueidentifyingthenewtimezone.
  • *
**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_TIMEZONE_CHANGED="android.intent.action.TIMEZONE_CHANGED";/***ClearDNSCacheAction:Thisisbroadcastwhennetworkshavechangedandold*DNSentriesshouldbetossed.*@hide*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_CLEAR_DNS_CACHE="android.intent.action.CLEAR_DNS_CACHE";/***AlarmChangedAction:ThisisbroadcastwhentheAlarmClock*application'salarmissetorunset.Itisusedbythe*AlarmClockapplicationandtheStatusBarservice.*@hide*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_ALARM_CHANGED="android.intent.action.ALARM_CHANGED";/***SyncStateChangedAction:Thisisbroadcastwhenthesyncstartsorstopsorwhenonehas*beenfailingforalongtime.ItisusedbytheSyncManagerandtheStatusBarservice.*@hide*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_SYNC_STATE_CHANGED="android.intent.action.SYNC_STATE_CHANGED";/***BroadcastAction:Thisisbroadcastonce,afterthesystemhasfinished*booting.Itcanbeusedtoperformapplication-specificinitialization,*suchasinstallingalarms.Youmustholdthe*{@linkandroid.Manifest.permission#RECEIVE_BOOT_COMPLETED}permission*inordertoreceivethisbroadcast.**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_BOOT_COMPLETED="android.intent.action.BOOT_COMPLETED";/***BroadcastAction:Thisisbroadcastwhenauseractionshouldrequesta*temporarysystemdialogtodismiss.Someexamplesoftemporarysystem*dialogsarethenotificationwindow-shadeandtherecenttasksdialog.*/publicstaticfinalStringACTION_CLOSE_SYSTEM_DIALOGS="android.intent.action.CLOSE_SYSTEM_DIALOGS";/***BroadcastAction:Triggerthedownloadandeventualinstallation*ofapackage.*

Input:{@link#getData}istheURIofthepackagefiletodownload.**Thisisaprotectedintentthatcanonlybesent*bythesystem.**@deprecatedThisconstanthasneverbeenused.*/@Deprecated@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_PACKAGE_INSTALL="android.intent.action.PACKAGE_INSTALL";/***BroadcastAction:Anewapplicationpackagehasbeeninstalledonthe*device.Thedatacontainsthenameofthepackage.Notethatthe*newlyinstalledpackagedoesnotreceivethisbroadcast.*

Myincludethefollowingextras:*

    *
  • {@link#EXTRA_UID}containingtheintegeruidassignedtothenewpackage.*
  • {@link#EXTRA_REPLACING}issettotrueifthisisfollowing*an{@link#ACTION_PACKAGE_REMOVED}broadcastforthesamepackage.*
**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_PACKAGE_ADDED="android.intent.action.PACKAGE_ADDED";/***BroadcastAction:Anewversionofanapplicationpackagehasbeen*installed,replacinganexistingversionthatwaspreviouslyinstalled.*Thedatacontainsthenameofthepackage.*

Myincludethefollowingextras:*

    *
  • {@link#EXTRA_UID}containingtheintegeruidassignedtothenewpackage.*
**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_PACKAGE_REPLACED="android.intent.action.PACKAGE_REPLACED";/***BroadcastAction:Anewversionofyourapplicationhasbeeninstalled*overanexistingone.Thisisonlysenttotheapplicationthatwas*replaced.Itdoesnotcontainanyadditionaldata;toreceiveit,just*useanintentfilterforthisaction.**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_MY_PACKAGE_REPLACED="android.intent.action.MY_PACKAGE_REPLACED";/***BroadcastAction:Anexistingapplicationpackagehasbeenremovedfrom*thedevice.Thedatacontainsthenameofthepackage.Thepackage*thatisbeinginstalleddoesnotreceivethisIntent.*
    *
  • {@link#EXTRA_UID}containingtheintegeruidpreviouslyassigned*tothepackage.*
  • {@link#EXTRA_DATA_REMOVED}issettotrueiftheentire*application--dataandcode--isbeingremoved.*
  • {@link#EXTRA_REPLACING}issettotrueifthiswillbefollowed*byan{@link#ACTION_PACKAGE_ADDED}broadcastforthesamepackage.*
**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_PACKAGE_REMOVED="android.intent.action.PACKAGE_REMOVED";/***BroadcastAction:Anexistingapplicationpackagehasbeencompletely*removedfromthedevice.Thedatacontainsthenameofthepackage.*Thisislike{@link#ACTION_PACKAGE_REMOVED},butonlysetwhen*{@link#EXTRA_DATA_REMOVED}istrueand*{@link#EXTRA_REPLACING}isfalseofthatbroadcast.**
    *
  • {@link#EXTRA_UID}containingtheintegeruidpreviouslyassigned*tothepackage.*
**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_PACKAGE_FULLY_REMOVED="android.intent.action.PACKAGE_FULLY_REMOVED";/***BroadcastAction:Anexistingapplicationpackagehasbeenchanged(e.g.*acomponenthasbeenenabledordisabled).Thedatacontainsthenameof*thepackage.*
    *
  • {@link#EXTRA_UID}containingtheintegeruidassignedtothepackage.*
  • {@link#EXTRA_CHANGED_COMPONENT_NAME_LIST}containingtheclassname*ofthechangedcomponents.*
  • {@link#EXTRA_DONT_KILL_APP}containingbooleanfieldtooverridethe*defaultactionofrestartingtheapplication.*
**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_PACKAGE_CHANGED="android.intent.action.PACKAGE_CHANGED";/***@hide*BroadcastAction:Asksystemservicesifthereisanyreasonto*restartthegivenpackage.Thedatacontainsthenameofthe*package.*
    *
  • {@link#EXTRA_UID}containingtheintegeruidassignedtothepackage.*
  • {@link#EXTRA_PACKAGES}Stringarrayofallpackagestocheck.*
**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_QUERY_PACKAGE_RESTART="android.intent.action.QUERY_PACKAGE_RESTART";/***BroadcastAction:Theuserhasrestartedapackage,andallofits*processeshavebeenkilled.Allruntimestate*associatedwithit(processes,alarms,notifications,etc)should*beremoved.Notethattherestartedpackagedoesnot*receivethisbroadcast.*Thedatacontainsthenameofthepackage.*
    *
  • {@link#EXTRA_UID}containingtheintegeruidassignedtothepackage.*
**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_PACKAGE_RESTARTED="android.intent.action.PACKAGE_RESTARTED";/***BroadcastAction:Theuserhasclearedthedataofapackage.Thisshould*beprecededby{@link#ACTION_PACKAGE_RESTARTED},afterwhichallof*itspersistentdataiserasedandthisbroadcastsent.*Notethattheclearedpackagedoesnot*receivethisbroadcast.Thedatacontainsthenameofthepackage.*
    *
  • {@link#EXTRA_UID}containingtheintegeruidassignedtothepackage.*
**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_PACKAGE_DATA_CLEARED="android.intent.action.PACKAGE_DATA_CLEARED";/***BroadcastAction:AuserIDhasbeenremovedfromthesystem.Theuser*IDnumberisstoredintheextradataunder{@link#EXTRA_UID}.**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_UID_REMOVED="android.intent.action.UID_REMOVED";/***BroadcastAction:Senttotheinstallerpackageofanapplication*whenthatapplicationisfirstlaunched(thatisthefirsttimeit*ismovedoutofthestoppedstate).Thedatacontainsthenameofthepackage.**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_PACKAGE_FIRST_LAUNCH="android.intent.action.PACKAGE_FIRST_LAUNCH";/***BroadcastAction:Senttothesystempackageverifierwhenapackage*needstobeverified.ThedatacontainsthepackageURI.**Thisisaprotectedintentthatcanonlybesentbythesystem.*

*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_PACKAGE_NEEDS_VERIFICATION="android.intent.action.PACKAGE_NEEDS_VERIFICATION";/***BroadcastAction:Resourcesforasetofpackages(whichwere*previouslyunavailable)arecurrently*availablesincethemediaonwhichtheyexistisavailable.*Theextradata{@link#EXTRA_CHANGED_PACKAGE_LIST}containsa*listofpackageswhoseavailabilitychanged.*Theextradata{@link#EXTRA_CHANGED_UID_LIST}containsa*listofuidsofpackageswhoseavailabilitychanged.*Notethatthe*packagesinthislistdonotreceivethisbroadcast.*Thespecifiedsetofpackagesarenowavailableonthesystem.*

Includesthefollowingextras:*

    *
  • {@link#EXTRA_CHANGED_PACKAGE_LIST}isthesetofpackages*whoseresources(werepreviouslyunavailable)arecurrentlyavailable.*{@link#EXTRA_CHANGED_UID_LIST}isthesetofuidsofthe*packageswhoseresources(werepreviouslyunavailable)*arecurrentlyavailable.*
**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_EXTERNAL_APPLICATIONS_AVAILABLE="android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE";/***BroadcastAction:Resourcesforasetofpackagesarecurrently*unavailablesincethemediaonwhichtheyexistisunavailable.*Theextradata{@link#EXTRA_CHANGED_PACKAGE_LIST}containsa*listofpackageswhoseavailabilitychanged.*Theextradata{@link#EXTRA_CHANGED_UID_LIST}containsa*listofuidsofpackageswhoseavailabilitychanged.*Thespecifiedsetofpackagescannolongerbe*launchedandarepracticallyunavailableonthesystem.*

Incluesthefollowingextras:*

    *
  • {@link#EXTRA_CHANGED_PACKAGE_LIST}isthesetofpackages*whoseresourcesarenolongeravailable.*{@link#EXTRA_CHANGED_UID_LIST}isthesetofpackages*whoseresourcesarenolongeravailable.*
**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE="android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE";/***BroadcastAction:Thecurrentsystemwallpaperhaschanged.See*{@linkandroid.app.WallpaperManager}forretrievingthenewwallpaper.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_WALLPAPER_CHANGED="android.intent.action.WALLPAPER_CHANGED";/***BroadcastAction:Thecurrentdevice{@linkandroid.content.res.Configuration}*(orientation,locale,etc)haschanged.Whensuchachangehappens,the*UIs(viewhierarchy)willneedtoberebuiltbasedonthisnew*information;forthemostpart,applicationsdon'tneedtoworryabout*this,becausethesystemwilltakecareofstoppingandrestartingthe*applicationtomakesureitseesthenewchanges.Somesystemcodethat*cannotberestartedwillneedtowatchforthisactionandhandleit*appropriately.***Youcannotreceivethisthroughcomponentsdeclared*inmanifests,onlybyexplicitlyregisteringforitwith*{@linkContext#registerReceiver(BroadcastReceiver,IntentFilter)*Context.registerReceiver()}.**Thisisaprotectedintentthatcanonlybesent*bythesystem.**@seeandroid.content.res.Configuration*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_CONFIGURATION_CHANGED="android.intent.action.CONFIGURATION_CHANGED";/***BroadcastAction:Thecurrentdevice'slocalehaschanged.**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_LOCALE_CHANGED="android.intent.action.LOCALE_CHANGED";/***BroadcastAction:Thisisastickybroadcastcontainingthe*chargingstate,level,andotherinformationaboutthebattery.*See{@linkandroid.os.BatteryManager}fordocumentationonthe*contentsoftheIntent.***Youcannotreceivethisthroughcomponentsdeclared*inmanifests,onlybyexplicitlyregisteringforitwith*{@linkContext#registerReceiver(BroadcastReceiver,IntentFilter)*Context.registerReceiver()}.See{@link#ACTION_BATTERY_LOW},*{@link#ACTION_BATTERY_OKAY},{@link#ACTION_POWER_CONNECTED},*and{@link#ACTION_POWER_DISCONNECTED}fordistinctbattery-related*broadcaststhataresentandcanbereceivedthroughmanifest*receivers.**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_BATTERY_CHANGED="android.intent.action.BATTERY_CHANGED";/***BroadcastAction:Indicateslowbatteryconditiononthedevice.*Thisbroadcastcorrespondstothe"Lowbatterywarning"systemdialog.**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_BATTERY_LOW="android.intent.action.BATTERY_LOW";/***BroadcastAction:Indicatesthebatteryisnowokayafterbeinglow.*Thiswillbesentafter{@link#ACTION_BATTERY_LOW}oncethebatteryhas*gonebackuptoanokaystate.**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_BATTERY_OKAY="android.intent.action.BATTERY_OKAY";/***BroadcastAction:Externalpowerhasbeenconnectedtothedevice.*Thisisintendedforapplicationsthatwishtoregisterspecificallytothisnotification.*UnlikeACTION_BATTERY_CHANGED,applicationswillbewokenforthisandsodonothaveto*stayactivetoreceivethisnotification.Thisactioncanbeusedtoimplementactions*thatwaituntilpowerisavailabletotrigger.**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_POWER_CONNECTED="android.intent.action.ACTION_POWER_CONNECTED";/***BroadcastAction:Externalpowerhasbeenremovedfromthedevice.*Thisisintendedforapplicationsthatwishtoregisterspecificallytothisnotification.*UnlikeACTION_BATTERY_CHANGED,applicationswillbewokenforthisandsodonothaveto*stayactivetoreceivethisnotification.Thisactioncanbeusedtoimplementactions*thatwaituntilpowerisavailabletotrigger.**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_POWER_DISCONNECTED="android.intent.action.ACTION_POWER_DISCONNECTED";/***BroadcastAction:Deviceisshuttingdown.*Thisisbroadcastwhenthedeviceisbeingshutdown(completelyturned*off,notsleeping).Oncethebroadcastiscomplete,thefinalshutdown*willproceedandallunsaveddatalost.Appswillnotnormallyneed*tohandlethis,sincetheforegroundactivitywillbepausedaswell.**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_SHUTDOWN="android.intent.action.ACTION_SHUTDOWN";/***ActivityAction:Startthisactivitytorequestsystemshutdown.*Theoptionalbooleanextrafield{@link#EXTRA_KEY_CONFIRM}canbesettotrue*torequestconfirmationfromtheuserbeforeshuttingdown.**Thisisaprotectedintentthatcanonlybesent*bythesystem.**{@hide}*/publicstaticfinalStringACTION_REQUEST_SHUTDOWN="android.intent.action.ACTION_REQUEST_SHUTDOWN";/***BroadcastAction:Astickybroadcastthatindicateslowmemory*conditiononthedevice**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_DEVICE_STORAGE_LOW="android.intent.action.DEVICE_STORAGE_LOW";/***BroadcastAction:Indicateslowmemoryconditiononthedevicenolongerexists**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_DEVICE_STORAGE_OK="android.intent.action.DEVICE_STORAGE_OK";/***BroadcastAction:Astickybroadcastthatindicatesamemoryfull*conditiononthedevice.Thisisintendedforactivitiesthatwant*tobeabletofillthedatapartitioncompletely,leavingonly*enoughfreespacetopreventsystem-wideSQLitefailures.**Thisisaprotectedintentthatcanonlybesent*bythesystem.**{@hide}*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_DEVICE_STORAGE_FULL="android.intent.action.DEVICE_STORAGE_FULL";/***BroadcastAction:Indicatesmemoryfullconditiononthedevice*nolongerexists.**Thisisaprotectedintentthatcanonlybesent*bythesystem.**{@hide}*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_DEVICE_STORAGE_NOT_FULL="android.intent.action.DEVICE_STORAGE_NOT_FULL";/***BroadcastAction:Indicateslowmemoryconditionnotificationacknowledgedbyuser*andpackagemanagementshouldbestarted.*ThisistriggeredbytheuserfromtheACTION_DEVICE_STORAGE_LOW*notification.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_MANAGE_PACKAGE_STORAGE="android.intent.action.MANAGE_PACKAGE_STORAGE";/***BroadcastAction:ThedevicehasenteredUSBMassStoragemode.*ThisisusedmainlyfortheUSBSettingspanel.*AppsshouldlistenforACTION_MEDIA_MOUNTEDandACTION_MEDIA_UNMOUNTEDbroadcaststobenotified*whentheSDcardfilesystemismountedorunmounted*@deprecatedreplacedbyandroid.os.storage.StorageEventListener*/@DeprecatedpublicstaticfinalStringACTION_UMS_CONNECTED="android.intent.action.UMS_CONNECTED";/***BroadcastAction:ThedevicehasexitedUSBMassStoragemode.*ThisisusedmainlyfortheUSBSettingspanel.*AppsshouldlistenforACTION_MEDIA_MOUNTEDandACTION_MEDIA_UNMOUNTEDbroadcaststobenotified*whentheSDcardfilesystemismountedorunmounted*@deprecatedreplacedbyandroid.os.storage.StorageEventListener*/@DeprecatedpublicstaticfinalStringACTION_UMS_DISCONNECTED="android.intent.action.UMS_DISCONNECTED";/***BroadcastAction:Externalmediahasbeenremoved.*ThepathtothemountpointfortheremovedmediaiscontainedintheIntent.mDatafield.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_MEDIA_REMOVED="android.intent.action.MEDIA_REMOVED";/***BroadcastAction:Externalmediaispresent,butnotmountedatitsmountpoint.*ThepathtothemountpointfortheremovedmediaiscontainedintheIntent.mDatafield.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_MEDIA_UNMOUNTED="android.intent.action.MEDIA_UNMOUNTED";/***BroadcastAction:Externalmediaispresent,andbeingdisk-checked*ThepathtothemountpointforthecheckingmediaiscontainedintheIntent.mDatafield.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_MEDIA_CHECKING="android.intent.action.MEDIA_CHECKING";/***BroadcastAction:Externalmediaispresent,butisusinganincompatiblefs(orisblank)*ThepathtothemountpointforthecheckingmediaiscontainedintheIntent.mDatafield.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_MEDIA_NOFS="android.intent.action.MEDIA_NOFS";/***BroadcastAction:Externalmediaispresentandmountedatitsmountpoint.*ThepathtothemountpointfortheremovedmediaiscontainedintheIntent.mDatafield.*TheIntentcontainsanextrawithname"read-only"andBooleanvaluetoindicateifthe*mediawasmountedreadonly.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_MEDIA_MOUNTED="android.intent.action.MEDIA_MOUNTED";/***BroadcastAction:ExternalmediaisunmountedbecauseitisbeingsharedviaUSBmassstorage.*ThepathtothemountpointforthesharedmediaiscontainedintheIntent.mDatafield.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_MEDIA_SHARED="android.intent.action.MEDIA_SHARED";/***BroadcastAction:ExternalmediaisnolongerbeingsharedviaUSBmassstorage.*ThepathtothemountpointforthepreviouslysharedmediaiscontainedintheIntent.mDatafield.**@hide*/publicstaticfinalStringACTION_MEDIA_UNSHARED="android.intent.action.MEDIA_UNSHARED";/***BroadcastAction:ExternalmediawasremovedfromSDcardslot,butmountpointwasnotunmounted.*ThepathtothemountpointfortheremovedmediaiscontainedintheIntent.mDatafield.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_MEDIA_BAD_REMOVAL="android.intent.action.MEDIA_BAD_REMOVAL";/***BroadcastAction:Externalmediaispresentbutcannotbemounted.*ThepathtothemountpointfortheremovedmediaiscontainedintheIntent.mDatafield.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_MEDIA_UNMOUNTABLE="android.intent.action.MEDIA_UNMOUNTABLE";/***BroadcastAction:Userhasexpressedthedesiretoremovetheexternalstoragemedia.*Applicationsshouldcloseallfilestheyhaveopenwithinthemountpointwhentheyreceivethisintent.*ThepathtothemountpointforthemediatobeejectediscontainedintheIntent.mDatafield.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_MEDIA_EJECT="android.intent.action.MEDIA_EJECT";/***BroadcastAction:Themediascannerhasstartedscanningadirectory.*ThepathtothedirectorybeingscannediscontainedintheIntent.mDatafield.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_MEDIA_SCANNER_STARTED="android.intent.action.MEDIA_SCANNER_STARTED";/***BroadcastAction:Themediascannerhasfinishedscanningadirectory.*ThepathtothescanneddirectoryiscontainedintheIntent.mDatafield.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_MEDIA_SCANNER_FINISHED="android.intent.action.MEDIA_SCANNER_FINISHED";/***BroadcastAction:Requestthemediascannertoscanafileandaddittothemediadatabase.*ThepathtothefileiscontainedintheIntent.mDatafield.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_MEDIA_SCANNER_SCAN_FILE="android.intent.action.MEDIA_SCANNER_SCAN_FILE";/***BroadcastAction:The"MediaButton"waspressed.Includesasingle*extrafield,{@link#EXTRA_KEY_EVENT},containingthekeyeventthat*causedthebroadcast.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_MEDIA_BUTTON="android.intent.action.MEDIA_BUTTON";/***BroadcastAction:The"CameraButton"waspressed.Includesasingle*extrafield,{@link#EXTRA_KEY_EVENT},containingthekeyeventthat*causedthebroadcast.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_CAMERA_BUTTON="android.intent.action.CAMERA_BUTTON";//***NOTE:@todo(*)Thefollowingreallyshouldgointoamoredomain-specific//location;theyarenotgeneral-purposeactions./***BroadcastAction:AGTalkconnectionhasbeenestablished.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_GTALK_SERVICE_CONNECTED="android.intent.action.GTALK_CONNECTED";/***BroadcastAction:AGTalkconnectionhasbeendisconnected.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_GTALK_SERVICE_DISCONNECTED="android.intent.action.GTALK_DISCONNECTED";/***BroadcastAction:Aninputmethodhasbeenchanged.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_INPUT_METHOD_CHANGED="android.intent.action.INPUT_METHOD_CHANGED";/***

BroadcastAction:TheuserhasswitchedthephoneintooroutofAirplaneMode.Oneor*moreradioshavebeenturnedofforon.Theintentwillhavethefollowingextravalue:

*
    *
  • state-AbooleanvalueindicatingwhetherAirplaneModeison.Iftrue,*thencellradioandpossiblyotherradiossuchasbluetoothorWiFimayhavealsobeen*turnedoff
  • *
**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_AIRPLANE_MODE_CHANGED="android.intent.action.AIRPLANE_MODE";/***BroadcastAction:Somecontentprovidershavepartsoftheirnamespace*wheretheypublishneweventsoritemsthattheusermaybeespecially*interestedin.Forthesethings,theymaybroadcastthisactionwhenthe*setofinterestingitemschange.**Forexample,GmailProvidersendsthisnotificationwhenthesetofunread*mailintheinboxchanges.**

Thedataoftheintentidentifieswhichpartofwhichprovider*changed.Whenqueriedthroughthecontentresolver,thedataURIwill*returnthedatasetinquestion.**

Theintentwillhavethefollowingextravalues:*

    *
  • count-Thenumberofitemsinthedataset.Thisisthe*sameasthenumberofitemsinthecursorreturnedbyqueryingthe*dataURI.
  • *
**Thisintentwillbesentatboot(ifthecountisnon-zero)andwhenthe*datasetchanges.Itispossibleforthedatasettochangewithoutthe*countchanging(forexample,ifanewunreadmessagearrivesinthesame*syncoperationinwhichamessageisarchived).Thephoneshouldstill*ring/vibrate/etcasnormalinthiscase.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_PROVIDER_CHANGED="android.intent.action.PROVIDER_CHANGED";/***BroadcastAction:WiredHeadsetpluggedinorunplugged.**

Theintentwillhavethefollowingextravalues:*

    *
  • state-0forunplugged,1forplugged.
  • *
  • name-Headsettype,humanreadablestring
  • *
  • microphone-1ifheadsethasamicrophone,0otherwise
  • *
**/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_HEADSET_PLUG="android.intent.action.HEADSET_PLUG";/***BroadcastAction:Ananalogaudiospeaker/headsetpluggedinorunplugged.**

Theintentwillhavethefollowingextravalues:*

    *
  • state-0forunplugged,1forplugged.
  • *
  • name-Headsettype,humanreadablestring
  • *
**@hide*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_USB_ANLG_HEADSET_PLUG="android.intent.action.USB_ANLG_HEADSET_PLUG";/***BroadcastAction:Adigitalaudiospeaker/headsetpluggedinorunplugged.**

Theintentwillhavethefollowingextravalues:*

    *
  • state-0forunplugged,1forplugged.
  • *
  • name-Headsettype,humanreadablestring
  • *
**@hide*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_USB_DGTL_HEADSET_PLUG="android.intent.action.USB_DGTL_HEADSET_PLUG";/***BroadcastAction:AHMDIcablewaspluggedorunplugged**

Theintentwillhavethefollowingextravalues:*

    *
  • state-0forunplugged,1forplugged.
  • *
  • name-HDMIcable,humanreadablestring
  • *
**@hide*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_HDMI_AUDIO_PLUG="android.intent.action.HDMI_AUDIO_PLUG";/***

BroadcastAction:Theuserhasswitchedonadvancedsettingsinthesettingsapp:

*
    *
  • state-Abooleanvalueindicatingwhetherthesettingsisonoroff.
  • *
**Thisisaprotectedintentthatcanonlybesent*bythesystem.**@hide*///@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_ADVANCED_SETTINGS_CHANGED="android.intent.action.ADVANCED_SETTINGS";/***BroadcastAction:Anoutgoingcallisabouttobeplaced.**

TheIntentwillhavethefollowingextravalue:*

    *
  • {@linkandroid.content.Intent#EXTRA_PHONE_NUMBER}-*thephonenumberoriginallyintendedtobedialed.
  • *
*

Oncethebroadcastisfinished,theresultDataisusedastheactual*numbertocall.Ifnull,nocallwillbeplaced.

*

Itisperfectlyacceptableformultiplereceiverstoprocessthe*outgoingcallinturn:forexample,aparentalcontrolapplication*mightverifythattheuserisauthorizedtoplacethecallatthat*time,thenanumber-rewritingapplicationmightaddanareacodeif*onewasnotspecified.

*

Forconsistency,anyreceiverwhosepurposeistoprohibitphone*callsshouldhaveapriorityof0,toensureitwillseethefinal*phonenumbertobedialed.*Anyreceiverwhosepurposeistorewritephonenumberstobecalled*shouldhaveapositivepriority.*Negativeprioritiesarereservedforthesystemforthisbroadcast;*usingthemmaycauseproblems.

*

AnyBroadcastReceiverreceivingthisIntentmustnot*abortthebroadcast.

*

Emergencycallscannotbeinterceptedusingthismechanism,and*othercallscannotbemodifiedtocallemergencynumbersusingthis*mechanism.*

Youmustholdthe*{@linkandroid.Manifest.permission#PROCESS_OUTGOING_CALLS}*permissiontoreceivethisIntent.

**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_NEW_OUTGOING_CALL="android.intent.action.NEW_OUTGOING_CALL";/***BroadcastAction:Havethedevicereboot.Thisisonlyforuseby*systemcode.**Thisisaprotectedintentthatcanonlybesent*bythesystem.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_REBOOT="android.intent.action.REBOOT";/***BroadcastAction:Astickybroadcastforchangesinthephysical*dockingstateofthedevice.**

Theintentwillhavethefollowingextravalues:*

    *
  • {@link#EXTRA_DOCK_STATE}-thecurrentdock*state,indicatingwhichdockthedeviceisphysicallyin.
  • *
*

Thisisintendedformonitoringthecurrentphysicaldockstate.*See{@linkandroid.app.UiModeManager}forthenormalAPIdealingwith*dockmodechanges.*/@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)publicstaticfinalStringACTION_DOCK_EVENT="android.intent.action.DOCK_EVENT";/***BroadcastAction:aremoteintentistobebroadcasted.**AremoteintentisusedforremoteRPCbetweendevices.Theremoteintent*isserializedandsentfromonedevicetoanotherdevice.Thereceiving*deviceparsestheremoteintentandbroadcastsit.Notethatanyonecan*broadcastaremoteintent.However,iftheintentreceiveroftheremoteintent*doesnottrustintentbroadcastsfromarbitraryintentsenders,itshouldrequire*thesendertoholdcertainpermissionssoonlytrustedsender'sbroadcastwillbe*letthrough.*@hide*/publicstaticfinalStringACTION_REMOTE_INTENT="com.google.android.c2dm.intent.RECEIVE";/***BroadcastAction:hookforpermformingcleanupafterasystemupdate.**Thebroadcastissentwhenthesystemisbooting,beforethe*BOOT_COMPLETEDbroadcast.Itisonlysenttoreceiversinthesystem*image.Areceiverforthisshoulddoitsworkandthendisableitself*sothatitdoesnotgetrunagainatthenextboot.*@hide*/publicstaticfinalStringACTION_PRE_BOOT_COMPLETED="android.intent.action.PRE_BOOT_COMPLETED";/***Broadcastsenttothesystemwhenauserisadded.CarriesanextraEXTRA_USERIDthathasthe*useridofthenewuser.*@hide*/publicstaticfinalStringACTION_USER_ADDED="android.intent.action.USER_ADDED";/***Broadcastsenttothesystemwhenauserisremoved.CarriesanextraEXTRA_USERIDthathas*theuseridoftheuser.*@hide*/publicstaticfinalStringACTION_USER_REMOVED="android.intent.action.USER_REMOVED";/***Broadcastsenttothesystemwhentheuserswitches.CarriesanextraEXTRA_USERIDthathas*theuseridoftheusertobecomethecurrentone.*@hide*/publicstaticfinalStringACTION_USER_SWITCHED="android.intent.action.USER_SWITCHED";//---------------------------------------------------------------------//---------------------------------------------------------------------//Standardintentcategories(seeaddCategory())./***Setiftheactivityshouldbeanoptionforthedefaultaction*(centerpress)toperformonapieceofdata.Settingthiswill*hidefromtheuseranyactivitieswithoutitsetwhenperformingan*actiononsomedata.Notethatthisisnormal-not-setinthe*Intentwheninitiatinganaction--itisforuseinintentfilters*specifiedinpackages.*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_DEFAULT="android.intent.category.DEFAULT";/***Activitiesthatcanbesafelyinvokedfromabrowsermustsupportthis*category.Forexample,iftheuserisviewingawebpageorane-mail*andclicksonalinkinthetext,theIntentgeneratedexecutethat*linkwillrequiretheBROWSABLEcategory,sothatonlyactivities*supportingthiscategorywillbeconsideredaspossibleactions.By*supportingthiscategory,youarepromisingthatthereisnothing*damaging(withoutuserintervention)thatcanhappenbyinvokingany*matchingIntent.*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_BROWSABLE="android.intent.category.BROWSABLE";/***Setiftheactivityshouldbeconsideredasanalternativeactionto*thedatatheuseriscurrentlyviewing.Seealso*{@link#CATEGORY_SELECTED_ALTERNATIVE}foranalternativeactionthat*appliestotheselectioninalistofitems.**

Supportingthiscategorymeansthatyouwouldlikeyouractivitytobe*displayedinthesetofalternativethingstheusercando,usuallyas*partofthecurrentactivity'soptionsmenu.Youwillusuallywantto*includeaspecificlabelinthe<intent-filter>ofthisaction*describingtotheuserwhatitdoes.**

TheactionofIntentFilterwiththiscategoryisimportantinthatit*describesthespecificactionthetargetwillperform.Thisgenerally*shouldnotbeagenericaction(suchas{@link#ACTION_VIEW},butrather*aspecificnamesuchas"com.android.camera.action.CROP.Onlyone*alternativeofanyparticularactionwillbeshowntotheuser,sousing*aspecificactionlikethismakessurethatyouralternativewillbe*displayedwhilealsoallowingotherapplicationstoprovidetheirown*overridesofthatparticularaction.*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_ALTERNATIVE="android.intent.category.ALTERNATIVE";/***Setiftheactivityshouldbeconsideredasanalternativeselection*actiontothedatatheuserhascurrentlyselected.Thisislike*{@link#CATEGORY_ALTERNATIVE},butisusedinactivitiesshowingalist*ofitemsfromwhichtheusercanselect,givingthemalternativestothe*defaultactionthatwillbeperformedonit.*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_SELECTED_ALTERNATIVE="android.intent.category.SELECTED_ALTERNATIVE";/***IntendedtobeusedasatabinsideofacontainingTabActivity.*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_TAB="android.intent.category.TAB";/***Shouldbedisplayedinthetop-levellauncher.*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_LAUNCHER="android.intent.category.LAUNCHER";/***Providesinformationaboutthepackageitisin;typicallyusedif*apackagedoesnotcontaina{@link#CATEGORY_LAUNCHER}toprovide*afront-doortotheuserwithouthavingtobeshownintheallappslist.*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_INFO="android.intent.category.INFO";/***Thisisthehomeactivity,thatisthefirstactivitythatisdisplayed*whenthedeviceboots.*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_HOME="android.intent.category.HOME";/***Thisactivityisapreferencepanel.*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_PREFERENCE="android.intent.category.PREFERENCE";/***Thisactivityisadevelopmentpreferencepanel.*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_DEVELOPMENT_PREFERENCE="android.intent.category.DEVELOPMENT_PREFERENCE";/***Capableofrunninginsideaparentactivitycontainer.*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_EMBED="android.intent.category.EMBED";/***Thisactivityallowstheusertobrowseanddownloadnewapplications.*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_APP_MARKET="android.intent.category.APP_MARKET";/***Thisactivitymaybeexercisedbythemonkeyorotherautomatedtesttools.*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_MONKEY="android.intent.category.MONKEY";/***Tobeusedasatest(notpartofthenormaluserexperience).*/publicstaticfinalStringCATEGORY_TEST="android.intent.category.TEST";/***Tobeusedasaunittest(runthroughtheTestHarness).*/publicstaticfinalStringCATEGORY_UNIT_TEST="android.intent.category.UNIT_TEST";/***Tobeusedasasamplecodeexample(notpartofthenormaluser*experience).*/publicstaticfinalStringCATEGORY_SAMPLE_CODE="android.intent.category.SAMPLE_CODE";/***UsedtoindicatethataGET_CONTENTintentonlywantsURIsthatcanbeopenedwith*ContentResolver.openInputStream.OpenableURIsmustsupportthecolumnsinOpenableColumns*whenqueried,thoughitisallowableforthosecolumnstobeblank.*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_OPENABLE="android.intent.category.OPENABLE";/***Tobeusedascodeundertestforframeworkinstrumentationtests.*/publicstaticfinalStringCATEGORY_FRAMEWORK_INSTRUMENTATION_TEST="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST";/***Anactivitytorunwhendeviceisinsertedintoacardock.*Usedwith{@link#ACTION_MAIN}tolaunchanactivity.Formore*information,see{@linkandroid.app.UiModeManager}.*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_CAR_DOCK="android.intent.category.CAR_DOCK";/***Anactivitytorunwhendeviceisinsertedintoacardock.*Usedwith{@link#ACTION_MAIN}tolaunchanactivity.Formore*information,see{@linkandroid.app.UiModeManager}.*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_DESK_DOCK="android.intent.category.DESK_DOCK";/***Anactivitytorunwhendeviceisinsertedintoaanalog(lowend)dock.*Usedwith{@link#ACTION_MAIN}tolaunchanactivity.Formore*information,see{@linkandroid.app.UiModeManager}.*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_LE_DESK_DOCK="android.intent.category.LE_DESK_DOCK";/***Anactivitytorunwhendeviceisinsertedintoadigital(highend)dock.*Usedwith{@link#ACTION_MAIN}tolaunchanactivity.Formore*information,see{@linkandroid.app.UiModeManager}.*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_HE_DESK_DOCK="android.intent.category.HE_DESK_DOCK";/***Usedtoindicatethattheactivitycanbeusedinacarenvironment.*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_CAR_MODE="android.intent.category.CAR_MODE";//---------------------------------------------------------------------//---------------------------------------------------------------------//Applicationlaunchintentcategories(seeaddCategory())./***Usedwith{@link#ACTION_MAIN}tolaunchthebrowserapplication.*TheactivityshouldbeabletobrowsetheInternet.*

NOTE:ThisshouldnotbeusedastheprimarykeyofanIntent,*sinceitwillnotresultintheapplaunchingwiththecorrect*actionandcategory.Instead,usethiswith*{@link#makeMainSelectorActivity(String,String)}togenerateamain*Intentwiththiscategoryintheselector.

*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_APP_BROWSER="android.intent.category.APP_BROWSER";/***Usedwith{@link#ACTION_MAIN}tolaunchthecalculatorapplication.*Theactivityshouldbeabletoperformstandardarithmeticoperations.*

NOTE:ThisshouldnotbeusedastheprimarykeyofanIntent,*sinceitwillnotresultintheapplaunchingwiththecorrect*actionandcategory.Instead,usethiswith*{@link#makeMainSelectorActivity(String,String)}togenerateamain*Intentwiththiscategoryintheselector.

*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_APP_CALCULATOR="android.intent.category.APP_CALCULATOR";/***Usedwith{@link#ACTION_MAIN}tolaunchthecalendarapplication.*Theactivityshouldbeabletoviewandmanipulatecalendarentries.*

NOTE:ThisshouldnotbeusedastheprimarykeyofanIntent,*sinceitwillnotresultintheapplaunchingwiththecorrect*actionandcategory.Instead,usethiswith*{@link#makeMainSelectorActivity(String,String)}togenerateamain*Intentwiththiscategoryintheselector.

*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_APP_CALENDAR="android.intent.category.APP_CALENDAR";/***Usedwith{@link#ACTION_MAIN}tolaunchthecontactsapplication.*Theactivityshouldbeabletoviewandmanipulateaddressbookentries.*

NOTE:ThisshouldnotbeusedastheprimarykeyofanIntent,*sinceitwillnotresultintheapplaunchingwiththecorrect*actionandcategory.Instead,usethiswith*{@link#makeMainSelectorActivity(String,String)}togenerateamain*Intentwiththiscategoryintheselector.

*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_APP_CONTACTS="android.intent.category.APP_CONTACTS";/***Usedwith{@link#ACTION_MAIN}tolaunchtheemailapplication.*Theactivityshouldbeabletosendandreceiveemail.*

NOTE:ThisshouldnotbeusedastheprimarykeyofanIntent,*sinceitwillnotresultintheapplaunchingwiththecorrect*actionandcategory.Instead,usethiswith*{@link#makeMainSelectorActivity(String,String)}togenerateamain*Intentwiththiscategoryintheselector.

*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_APP_EMAIL="android.intent.category.APP_EMAIL";/***Usedwith{@link#ACTION_MAIN}tolaunchthegalleryapplication.*Theactivityshouldbeabletoviewandmanipulateimageandvideofiles*storedonthedevice.*

NOTE:ThisshouldnotbeusedastheprimarykeyofanIntent,*sinceitwillnotresultintheapplaunchingwiththecorrect*actionandcategory.Instead,usethiswith*{@link#makeMainSelectorActivity(String,String)}togenerateamain*Intentwiththiscategoryintheselector.

*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_APP_GALLERY="android.intent.category.APP_GALLERY";/***Usedwith{@link#ACTION_MAIN}tolaunchthemapsapplication.*Theactivityshouldbeabletoshowtheuser'scurrentlocationandsurroundings.*

NOTE:ThisshouldnotbeusedastheprimarykeyofanIntent,*sinceitwillnotresultintheapplaunchingwiththecorrect*actionandcategory.Instead,usethiswith*{@link#makeMainSelectorActivity(String,String)}togenerateamain*Intentwiththiscategoryintheselector.

*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_APP_MAPS="android.intent.category.APP_MAPS";/***Usedwith{@link#ACTION_MAIN}tolaunchthemessagingapplication.*Theactivityshouldbeabletosendandreceivetextmessages.*

NOTE:ThisshouldnotbeusedastheprimarykeyofanIntent,*sinceitwillnotresultintheapplaunchingwiththecorrect*actionandcategory.Instead,usethiswith*{@link#makeMainSelectorActivity(String,String)}togenerateamain*Intentwiththiscategoryintheselector.

*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_APP_MESSAGING="android.intent.category.APP_MESSAGING";/***Usedwith{@link#ACTION_MAIN}tolaunchthemusicapplication.*Theactivityshouldbeabletoplay,browse,ormanipulatemusicfiles*storedonthedevice.*

NOTE:ThisshouldnotbeusedastheprimarykeyofanIntent,*sinceitwillnotresultintheapplaunchingwiththecorrect*actionandcategory.Instead,usethiswith*{@link#makeMainSelectorActivity(String,String)}togenerateamain*Intentwiththiscategoryintheselector.

*/@SdkConstant(SdkConstantType.INTENT_CATEGORY)publicstaticfinalStringCATEGORY_APP_MUSIC="android.intent.category.APP_MUSIC";//---------------------------------------------------------------------//---------------------------------------------------------------------//Standardextradatakeys./***Theinitialdatatoplaceinanewlycreatedrecord.Usewith*{@link#ACTION_INSERT}.ThedatahereisaMapcontainingthesame*fieldsaswouldbegiventotheunderlyingContentProvider.insert()*call.*/publicstaticfinalStringEXTRA_TEMPLATE="android.intent.extra.TEMPLATE";/***AconstantCharSequencethatisassociatedwiththeIntent,usedwith*{@link#ACTION_SEND}tosupplytheliteraldatatobesent.Notethat*thismaybeastyledCharSequence,soyoumustuse*{@linkBundle#getCharSequence(String)Bundle.getCharSequence()}to*retrieveit.*/publicstaticfinalStringEXTRA_TEXT="android.intent.extra.TEXT";/***Acontent:URIholdingastreamofdataassociatedwiththeIntent,*usedwith{@link#ACTION_SEND}tosupplythedatabeingsent.*/publicstaticfinalStringEXTRA_STREAM="android.intent.extra.STREAM";/***AString[]holdinge-mailaddressesthatshouldbedeliveredto.*/publicstaticfinalStringEXTRA_EMAIL="android.intent.extra.EMAIL";/***AString[]holdinge-mailaddressesthatshouldbecarboncopied.*/publicstaticfinalStringEXTRA_CC="android.intent.extra.CC";/***AString[]holdinge-mailaddressesthatshouldbeblindcarboncopied.*/publicstaticfinalStringEXTRA_BCC="android.intent.extra.BCC";/***Aconstantstringholdingthedesiredsubjectlineofamessage.*/publicstaticfinalStringEXTRA_SUBJECT="android.intent.extra.SUBJECT";/***AnIntentdescribingthechoicesyouwouldlikeshownwith*{@link#ACTION_PICK_ACTIVITY}.*/publicstaticfinalStringEXTRA_INTENT="android.intent.extra.INTENT";/***ACharSequencedialogtitletoprovidetotheuserwhenusedwitha*{@link#ACTION_CHOOSER}.*/publicstaticfinalStringEXTRA_TITLE="android.intent.extra.TITLE";/***AParcelable[]of{@linkIntent}or*{@linkandroid.content.pm.LabeledIntent}objectsassetwith*{@link#putExtra(String,Parcelable[])}ofadditionalactivitiestoplace*athefrontofthelistofchoices,whenshowntotheuserwitha*{@link#ACTION_CHOOSER}.*/publicstaticfinalStringEXTRA_INITIAL_INTENTS="android.intent.extra.INITIAL_INTENTS";/***A{@linkandroid.view.KeyEvent}objectcontainingtheeventthat*triggeredthecreationoftheIntentitisin.*/publicstaticfinalStringEXTRA_KEY_EVENT="android.intent.extra.KEY_EVENT";/***Settotruein{@link#ACTION_REQUEST_SHUTDOWN}torequestconfirmationfromtheuser*beforeshuttingdown.**{@hide}*/publicstaticfinalStringEXTRA_KEY_CONFIRM="android.intent.extra.KEY_CONFIRM";/***Usedasabooleanextrafieldin{@linkandroid.content.Intent#ACTION_PACKAGE_REMOVED}or*{@linkandroid.content.Intent#ACTION_PACKAGE_CHANGED}intentstooverridethedefaultaction*ofrestartingtheapplication.*/publicstaticfinalStringEXTRA_DONT_KILL_APP="android.intent.extra.DONT_KILL_APP";/***AStringholdingthephonenumberoriginallyenteredin*{@linkandroid.content.Intent#ACTION_NEW_OUTGOING_CALL},ortheactual*numbertocallina{@linkandroid.content.Intent#ACTION_CALL}.*/publicstaticfinalStringEXTRA_PHONE_NUMBER="android.intent.extra.PHONE_NUMBER";/***Usedasanintextrafieldin{@linkandroid.content.Intent#ACTION_UID_REMOVED}*intentstosupplytheuidthepackagehadbeenassigned.Alsoanoptional*extrain{@linkandroid.content.Intent#ACTION_PACKAGE_REMOVED}or*{@linkandroid.content.Intent#ACTION_PACKAGE_CHANGED}forthesame*purpose.*/publicstaticfinalStringEXTRA_UID="android.intent.extra.UID";/***@hideStringarrayofpackagenames.*/publicstaticfinalStringEXTRA_PACKAGES="android.intent.extra.PACKAGES";/***Usedasabooleanextrafieldin{@linkandroid.content.Intent#ACTION_PACKAGE_REMOVED}*intentstoindicatewhetherthisrepresentsafulluninstall(removing*boththecodeanditsdata)orapartialuninstall(leavingitsdata,*implyingthatthisisanupdate).*/publicstaticfinalStringEXTRA_DATA_REMOVED="android.intent.extra.DATA_REMOVED";/***Usedasabooleanextrafieldin{@linkandroid.content.Intent#ACTION_PACKAGE_REMOVED}*intentstoindicatethatthisisareplacementofthepackage,sothis*broadcastwillimmediatelybefollowedbyanaddbroadcastfora*differentversionofthesamepackage.*/publicstaticfinalStringEXTRA_REPLACING="android.intent.extra.REPLACING";/***Usedasanintextrafieldin{@linkandroid.app.AlarmManager}intents*totelltheapplicationbeinginvokedhowmanypendingalarmsarebeing*delieveredwiththeintent.Forone-shotalarmsthiswillalwaysbe1.*Forrecurringalarms,thismightbegreaterthan1ifthedevicewas*asleeporpoweredoffatthetimeanearlieralarmwouldhavebeen*delivered.*/publicstaticfinalStringEXTRA_ALARM_COUNT="android.intent.extra.ALARM_COUNT";/***Usedasanintextrafieldin{@linkandroid.content.Intent#ACTION_DOCK_EVENT}*intentstorequestthedockstate.Possiblevaluesare*{@linkandroid.content.Intent#EXTRA_DOCK_STATE_UNDOCKED},*{@linkandroid.content.Intent#EXTRA_DOCK_STATE_DESK},or*{@linkandroid.content.Intent#EXTRA_DOCK_STATE_CAR},or*{@linkandroid.content.Intent#EXTRA_DOCK_STATE_LE_DESK},or*{@linkandroid.content.Intent#EXTRA_DOCK_STATE_HE_DESK}.*/publicstaticfinalStringEXTRA_DOCK_STATE="android.intent.extra.DOCK_STATE";/***Usedasanintvaluefor{@linkandroid.content.Intent#EXTRA_DOCK_STATE}*torepresentthatthephoneisnotinanydock.*/publicstaticfinalintEXTRA_DOCK_STATE_UNDOCKED=0;/***Usedasanintvaluefor{@linkandroid.content.Intent#EXTRA_DOCK_STATE}*torepresentthatthephoneisinadeskdock.*/publicstaticfinalintEXTRA_DOCK_STATE_DESK=1;/***Usedasanintvaluefor{@linkandroid.content.Intent#EXTRA_DOCK_STATE}*torepresentthatthephoneisinacardock.*/publicstaticfinalintEXTRA_DOCK_STATE_CAR=2;/***Usedasanintvaluefor{@linkandroid.content.Intent#EXTRA_DOCK_STATE}*torepresentthatthephoneisinaanalog(lowend)dock.*/publicstaticfinalintEXTRA_DOCK_STATE_LE_DESK=3;/***Usedasanintvaluefor{@linkandroid.content.Intent#EXTRA_DOCK_STATE}*torepresentthatthephoneisinadigital(highend)dock.*/publicstaticfinalintEXTRA_DOCK_STATE_HE_DESK=4;/***Booleanthatcanbesuppliedasmeta-datawithadockactivity,to*indicatethatthedockshouldtakeoverthehomekeywhenitisactive.*/publicstaticfinalStringMETADATA_DOCK_HOME="android.dock_home";/***Usedasaparcelableextrafieldin{@link#ACTION_APP_ERROR},containing*thebugreport.*/publicstaticfinalStringEXTRA_BUG_REPORT="android.intent.extra.BUG_REPORT";/***Usedintheextrafieldintheremoteintent.It'sastringtokenpassedwiththe*remoteintent.*/publicstaticfinalStringEXTRA_REMOTE_INTENT_TOKEN="android.intent.extra.remote_intent_token";/***@deprecatedSee{@link#EXTRA_CHANGED_COMPONENT_NAME_LIST};thisfield*willcontainonlythefirstnameinthelist.*/@DeprecatedpublicstaticfinalStringEXTRA_CHANGED_COMPONENT_NAME="android.intent.extra.changed_component_name";/***Thisfieldispartof{@linkandroid.content.Intent#ACTION_PACKAGE_CHANGED},*andcontainsastringarrayofallofthecomponentsthathavechanged.*/publicstaticfinalStringEXTRA_CHANGED_COMPONENT_NAME_LIST="android.intent.extra.changed_component_name_list";/***Thisfieldispartof*{@linkandroid.content.Intent#ACTION_EXTERNAL_APPLICATIONS_AVAILABLE},*{@linkandroid.content.Intent#ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE}*andcontainsastringarrayofallofthecomponentsthathavechanged.*/publicstaticfinalStringEXTRA_CHANGED_PACKAGE_LIST="android.intent.extra.changed_package_list";/***Thisfieldispartof*{@linkandroid.content.Intent#ACTION_EXTERNAL_APPLICATIONS_AVAILABLE},*{@linkandroid.content.Intent#ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE}*andcontainsanintegerarrayofuidsofallofthecomponents*thathavechanged.*/publicstaticfinalStringEXTRA_CHANGED_UID_LIST="android.intent.extra.changed_uid_list";/***@hide*Magicextrasystemcodecanusewhenbinding,togivealabelfor*whoitisthathasboundtoaservice.Thisisanintegergiving*aframeworkstringresourcethatcanbedisplayedtotheuser.*/publicstaticfinalStringEXTRA_CLIENT_LABEL="android.intent.extra.client_label";/***@hide*Magicextrasystemcodecanusewhenbinding,togiveaPendingIntentobject*thatcanbelaunchedfortheusertodisablethesystem'suseofthis*service.*/publicstaticfinalStringEXTRA_CLIENT_INTENT="android.intent.extra.client_intent";/***Usedtoindicatethata{@link#ACTION_GET_CONTENT}intentshouldonlyreturn*datathatisonthelocaldevice.Thisisabooleanextra;thedefault*isfalse.Iftrue,animplementationofACTION_GET_CONTENTshouldonlyallow*theusertoselectmediathatisalreadyonthedevice,notrequiringit*bedownloadedfromaremoteservicewhenopened.Anotherwaytolook*atitisthatsuchcontentshouldgenerallyhavea"_data"columntothe*pathofthecontentonlocalexternalstorage.*/publicstaticfinalStringEXTRA_LOCAL_ONLY="android.intent.extra.LOCAL_ONLY";/***Theuseridcarriedwithbroadcastintentsrelatedtoaddition,removalandswitchingofusers*-{@link#ACTION_USER_ADDED},{@link#ACTION_USER_REMOVED}and{@link#ACTION_USER_SWITCHED}.*@hide*/publicstaticfinalStringEXTRA_USERID="android.intent.extra.user_id";//---------------------------------------------------------------------//---------------------------------------------------------------------//Intentflags(seemFlagsvariable)./***Ifset,therecipientofthisIntentwillbegrantedpermissionto*performreadoperationsontheUriintheIntent'sdataandanyURIs*specifiedinitsClipData.WhenapplyingtoanIntent'sClipData,*allURIsaswellasrecursivetraversalsthroughdataorotherClipData*inIntentitemswillbegranted;onlythegrantflagsofthetop-level*Intentareused.*/publicstaticfinalintFLAG_GRANT_READ_URI_PERMISSION=0x00000001;/***Ifset,therecipientofthisIntentwillbegrantedpermissionto*performwriteoperationsontheUriintheIntent'sdataandanyURIs*specifiedinitsClipData.WhenapplyingtoanIntent'sClipData,*allURIsaswellasrecursivetraversalsthroughdataorotherClipData*inIntentitemswillbegranted;onlythegrantflagsofthetop-level*Intentareused.*/publicstaticfinalintFLAG_GRANT_WRITE_URI_PERMISSION=0x00000002;/***CanbesetbythecallertoindicatethatthisIntentiscomingfrom*abackgroundoperation,notfromdirectuserinteraction.*/publicstaticfinalintFLAG_FROM_BACKGROUND=0x00000004;/***Aflagyoucanenablefordebugging:whenset,logmessageswillbe*printedduringtheresolutionofthisintenttoshowyouwhathas*beenfoundtocreatethefinalresolvedlist.*/publicstaticfinalintFLAG_DEBUG_LOG_RESOLUTION=0x00000008;/***Ifset,thisintentwillnotmatchanycomponentsinpackagesthat*arecurrentlystopped.Ifthisisnotset,thenthedefaultbehavior*istoincludesuchapplicationsintheresult.*/publicstaticfinalintFLAG_EXCLUDE_STOPPED_PACKAGES=0x00000010;/***Ifset,thisintentwillalwaysmatchanycomponentsinpackagesthat*arecurrentlystopped.Thisisthedefaultbehaviorwhen*{@link#FLAG_EXCLUDE_STOPPED_PACKAGES}isnotset.Ifbothofthese*flagsareset,thisonewins(itallowsoverridingofexcludefor*placeswheretheframeworkmayautomaticallysettheexcludeflag).*/publicstaticfinalintFLAG_INCLUDE_STOPPED_PACKAGES=0x00000020;/***Ifset,thenewactivityisnotkeptinthehistorystack.Assoonas*theusernavigatesawayfromit,theactivityisfinished.Thismayalso*besetwiththe{@linkandroid.R.styleable#AndroidManifestActivity_noHistory*noHistory}attribute.*/publicstaticfinalintFLAG_ACTIVITY_NO_HISTORY=0x40000000;/***Ifset,theactivitywillnotbelaunchedifitisalreadyrunning*atthetopofthehistorystack.*/publicstaticfinalintFLAG_ACTIVITY_SINGLE_TOP=0x20000000;/***Ifset,thisactivitywillbecomethestartofanewtaskonthis*historystack.Atask(fromtheactivitythatstartedittothe*nexttaskactivity)definesanatomicgroupofactivitiesthatthe*usercanmoveto.Taskscanbemovedtotheforegroundandbackground;*alloftheactivitiesinsideofaparticulartaskalwaysremainin*thesameorder.See*TasksandBack*Stackformoreinformationabouttasks.**

Thisflagisgenerallyusedbyactivitiesthatwant*topresenta"launcher"stylebehavior:theygivetheuseralistof*separatethingsthatcanbedone,whichotherwiseruncompletely*independentlyoftheactivitylaunchingthem.**

Whenusingthisflag,ifataskisalreadyrunningfortheactivity*youarenowstarting,thenanewactivitywillnotbestarted;instead,*thecurrenttaskwillsimplybebroughttothefrontofthescreenwith*thestateitwaslastin.See{@link#FLAG_ACTIVITY_MULTIPLE_TASK}foraflag*todisablethisbehavior.**

Thisflagcannotbeusedwhenthecallerisrequestingaresultfrom*theactivitybeinglaunched.*/publicstaticfinalintFLAG_ACTIVITY_NEW_TASK=0x10000000;/***Donotusethisflagunlessyouareimplementingyourown*top-levelapplicationlauncher.Usedinconjunctionwith*{@link#FLAG_ACTIVITY_NEW_TASK}todisablethe*behaviorofbringinganexistingtasktotheforeground.Whenset,*anewtaskisalwaysstartedtohosttheActivityforthe*Intent,regardlessofwhetherthereisalreadyanexistingtaskrunning*thesamething.**

Becausethedefaultsystemdoesnotincludegraphicaltaskmanagement,*youshouldnotusethisflagunlessyouprovidesomewayforauserto*returnbacktothetasksyouhavelaunched.**

Thisflagisignoredif*{@link#FLAG_ACTIVITY_NEW_TASK}isnotset.**

See*TasksandBack*Stackformoreinformationabouttasks.*/publicstaticfinalintFLAG_ACTIVITY_MULTIPLE_TASK=0x08000000;/***Ifset,andtheactivitybeinglaunchedisalreadyrunninginthe*currenttask,theninsteadoflaunchinganewinstanceofthatactivity,*alloftheotheractivitiesontopofitwillbeclosedandthisIntent*willbedeliveredtothe(nowontop)oldactivityasanewIntent.**

Forexample,considerataskconsistingoftheactivities:A,B,C,D.*IfDcallsstartActivity()withanIntentthatresolvestothecomponent*ofactivityB,thenCandDwillbefinishedandBreceivethegiven*Intent,resultinginthestacknowbeing:A,B.**

ThecurrentlyrunninginstanceofactivityBintheaboveexamplewill*eitherreceivethenewintentyouarestartinghereinits*onNewIntent()method,orbeitselffinishedandrestartedwiththe*newintent.Ifithasdeclareditslaunchmodetobe"multiple"(the*default)andyouhavenotset{@link#FLAG_ACTIVITY_SINGLE_TOP}in*thesameintent,thenitwillbefinishedandre-created;forallother*launchmodesorif{@link#FLAG_ACTIVITY_SINGLE_TOP}issetthenthis*Intentwillbedeliveredtothecurrentinstance'sonNewIntent().**

Thislaunchmodecanalsobeusedtogoodeffectinconjunctionwith*{@link#FLAG_ACTIVITY_NEW_TASK}:ifusedtostarttherootactivity*ofatask,itwillbringanycurrentlyrunninginstanceofthattask*totheforeground,andthenclearittoitsrootstate.Thisis*especiallyuseful,forexample,whenlaunchinganactivityfromthe*notificationmanager.**

See*TasksandBack*Stackformoreinformationabouttasks.*/publicstaticfinalintFLAG_ACTIVITY_CLEAR_TOP=0x04000000;/***Ifsetandthisintentisbeingusedtolaunchanewactivityfroman*existingone,thenthereplytargetoftheexistingactivitywillbe*transferedtothenewactivity.Thiswaythenewactivitycancall*{@linkandroid.app.Activity#setResult}andhavethatresultsentbackto*thereplytargetoftheoriginalactivity.*/publicstaticfinalintFLAG_ACTIVITY_FORWARD_RESULT=0x02000000;/***Ifsetandthisintentisbeingusedtolaunchanewactivityfroman*existingone,thecurrentactivitywillnotbecountedasthetop*activityfordecidingwhetherthenewintentshouldbedeliveredto*thetopinsteadofstartinganewone.Thepreviousactivitywill*beusedasthetop,withtheassumptionbeingthatthecurrentactivity*willfinishitselfimmediately.*/publicstaticfinalintFLAG_ACTIVITY_PREVIOUS_IS_TOP=0x01000000;/***Ifset,thenewactivityisnotkeptinthelistofrecentlylaunched*activities.*/publicstaticfinalintFLAG_ACTIVITY_EXCLUDE_FROM_RECENTS=0x00800000;/***Thisflagisnotnormallysetbyapplicationcode,butsetforyouby*thesystemasdescribedinthe*{@linkandroid.R.styleable#AndroidManifestActivity_launchMode*launchMode}documentationforthesingleTaskmode.*/publicstaticfinalintFLAG_ACTIVITY_BROUGHT_TO_FRONT=0x00400000;/***Ifset,andthisactivityiseitherbeingstartedinanewtaskor*bringingtothetopanexistingtask,thenitwillbelaunchedas*thefrontdoorofthetask.Thiswillresultintheapplicationof*anyaffinitiesneededtohavethattaskintheproperstate(either*movingactivitiestoorfromit),orsimplyresettingthattaskto*itsinitialstateifneeded.*/publicstaticfinalintFLAG_ACTIVITY_RESET_TASK_IF_NEEDED=0x00200000;/***Thisflagisnotnormallysetbyapplicationcode,butsetforyouby*thesystemifthisactivityisbeinglaunchedfromhistory*(longpresshomekey).*/publicstaticfinalintFLAG_ACTIVITY_LAUNCHED_FROM_HISTORY=0x00100000;/***Ifset,thismarksapointinthetask'sactivitystackthatshould*beclearedwhenthetaskisreset.Thatis,thenexttimethetask*isbroughttotheforegroundwith*{@link#FLAG_ACTIVITY_RESET_TASK_IF_NEEDED}(typicallyasaresultof*theuserre-launchingitfromhome),thisactivityandallontopof*itwillbefinishedsothattheuserdoesnotreturntothem,but*insteadreturnstowhateveractivitypreceededit.**

Thisisusefulforcaseswhereyouhavealogicalbreakinyour*application.Forexample,ane-mailapplicationmayhaveacommand*toviewanattachment,whichlaunchesanimageviewactivityto*displayit.Thisactivityshouldbepartofthee-mailapplication's*task,sinceitisapartofthetasktheuserisinvolvedin.However,*iftheuserleavesthattask,andlaterselectsthee-mailappfrom*home,wemaylikethemtoreturntotheconversationtheywere*viewing,notthepictureattachment,sincethatisconfusing.By*settingthisflagwhenlaunchingtheimageviewer,thatviewerand*anyactivitiesitstartswillberemovedthenexttimetheuserreturns*tomail.*/publicstaticfinalintFLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET=0x00080000;/***Ifset,thisflagwillpreventthenormal{@linkandroid.app.Activity#onUserLeaveHint}*callbackfromoccurringonthecurrentfrontmostactivitybeforeitis*pausedasthenewly-startedactivityisbroughttothefront.**

Typically,anactivitycanrelyonthatcallbacktoindicatethatan*explicituseractionhascausedtheiractivitytobemovedoutofthe*foreground.Thecallbackmarksanappropriatepointintheactivity's*lifecycleforittodismissanynotificationsthatitintendstodisplay*"untiltheuserhasseenthem,"suchasablinkingLED.**

Ifanactivityiseverstartedviaanynon-user-driveneventssuchas*phone-callreceiptoranalarmhandler,thisflagshouldbepassedto{@link*Context#startActivityContext.startActivity},ensuringthatthepausing*activitydoesnotthinktheuserhasacknowledgeditsnotification.*/publicstaticfinalintFLAG_ACTIVITY_NO_USER_ACTION=0x00040000;/***IfsetinanIntentpassedto{@linkContext#startActivityContext.startActivity()},*thisflagwillcausethelaunchedactivitytobebroughttothefrontofits*task'shistorystackifitisalreadyrunning.**

Forexample,considerataskconsistingoffouractivities:A,B,C,D.*IfDcallsstartActivity()withanIntentthatresolvestothecomponent*ofactivityB,thenBwillbebroughttothefrontofthehistorystack,*withthisresultingorder:A,C,D,B.**Thisflagwillbeignoredif{@link#FLAG_ACTIVITY_CLEAR_TOP}isalso*specified.*/publicstaticfinalintFLAG_ACTIVITY_REORDER_TO_FRONT=0X00020000;/***IfsetinanIntentpassedto{@linkContext#startActivityContext.startActivity()},*thisflagwillpreventthesystemfromapplyinganactivitytransition*animationtogotothenextactivitystate.Thisdoesn'tmeanan*animationwillneverrun--ifanotheractivitychangehappensthatdoesn't*specifythisflagbeforetheactivitystartedhereisdisplayed,then*thattransitionwillbeused.Thisflagcanbeputtogooduse*whenyouaregoingtodoaseriesofactivityoperationsbutthe*animationseenbytheusershouldn'tbedrivenbythefirstactivity*changebutratheralaterone.*/publicstaticfinalintFLAG_ACTIVITY_NO_ANIMATION=0X00010000;/***IfsetinanIntentpassedto{@linkContext#startActivityContext.startActivity()},*thisflagwillcauseanyexistingtaskthatwouldbeassociatedwiththe*activitytobeclearedbeforetheactivityisstarted.Thatis,theactivity*becomesthenewrootofanotherwiseemptytask,andanyoldactivities*arefinished.Thiscanonlybeusedinconjunctionwith{@link#FLAG_ACTIVITY_NEW_TASK}.*/publicstaticfinalintFLAG_ACTIVITY_CLEAR_TASK=0X00008000;/***IfsetinanIntentpassedto{@linkContext#startActivityContext.startActivity()},*thisflagwillcauseanewlylaunchingtasktobeplacedontopofthecurrent*homeactivitytask(ifthereisone).Thatis,pressingbackfromthetask*willalwaysreturntheusertohomeevenifthatwasnotthelastactivitythey*saw.Thiscanonlybeusedinconjunctionwith{@link#FLAG_ACTIVITY_NEW_TASK}.*/publicstaticfinalintFLAG_ACTIVITY_TASK_ON_HOME=0X00004000;/***Ifset,whensendingabroadcastonlyregisteredreceiverswillbe*called--noBroadcastReceivercomponentswillbelaunched.*/publicstaticfinalintFLAG_RECEIVER_REGISTERED_ONLY=0x40000000;/***Ifset,whensendingabroadcastthenewbroadcastwillreplace*anyexistingpendingbroadcastthatmatchesit.Matchingisdefined*by{@linkIntent#filterEquals(Intent)Intent.filterEquals}returning*truefortheintentsofthetwobroadcasts.Whenamatchisfound,*thenewbroadcast(andreceiversassociatedwithit)willreplacethe*existingoneinthependingbroadcastlist,remainingatthesame*positioninthelist.**

Thisflagismosttypicallyusedwithstickybroadcasts,which*onlycareaboutdeliveringthemostrecentvaluesofthebroadcast*totheirreceivers.*/publicstaticfinalintFLAG_RECEIVER_REPLACE_PENDING=0x20000000;/***Ifset,whensendingabroadcasttherecipientisallowedtorunat*foregroundpriority,withashortertimeoutinterval.Duringnormal*broadcaststhereceiversarenotautomaticallyhoistedoutofthe*backgroundpriorityclass.*/publicstaticfinalintFLAG_RECEIVER_FOREGROUND=0x10000000;/***Ifset,whensendingabroadcastbeforeboothascompletedonly*registeredreceiverswillbecalled--noBroadcastReceivercomponents*willbelaunched.Stickyintentstatewillberecordedproperlyeven*ifnoreceiverswindupbeingcalled.If{@link#FLAG_RECEIVER_REGISTERED_ONLY}*isspecifiedinthebroadcastintent,thisflagisunnecessary.**

Thisflagisonlyforusebysystemsevicesasaconvenienceto*avoidhavingtoimplementamorecomplexmechanismarounddetection*ofbootcompletion.**@hide*/publicstaticfinalintFLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT=0x08000000;/***Setwhenthisbroadcastisforabootupgrade,aspecialmodethat*allowsthebroadcasttobesentbeforethesystemisreadyandlaunches*theappprocesswithnoprovidersrunninginit.*@hide*/publicstaticfinalintFLAG_RECEIVER_BOOT_UPGRADE=0x04000000;/***@hideFlagsthatcan'tbechangedwithPendingIntent.*/publicstaticfinalintIMMUTABLE_FLAGS=FLAG_GRANT_READ_URI_PERMISSION|FLAG_GRANT_WRITE_URI_PERMISSION;//---------------------------------------------------------------------//---------------------------------------------------------------------//toUri()andparseUri()options./***Flagforusewith{@link#toUri}and{@link#parseUri}:theURIstring*alwayshasthe"intent:"scheme.Thissyntaxcanbeusedwhenyouwant*tolaterdisambiguatebetweenURIsthatareintendedtodescribean*Intentvs.allothersthatshouldbetreatedasrawURIs.Whenused*with{@link#parseUri},anyotherschemewillresultinageneric*VIEWactionforthatrawURI.*/publicstaticfinalintURI_INTENT_SCHEME=1<<0;//---------------------------------------------------------------------privateStringmAction;privateUrimData;privateStringmType;privateStringmPackage;privateComponentNamemComponent;privateintmFlags;privateHashSetmCategories;privateBundlemExtras;privateRectmSourceBounds;privateIntentmSelector;privateClipDatamClipData;//---------------------------------------------------------------------/***Createanemptyintent.*/publicIntent(){}/***Copyconstructor.*/publicIntent(Intento){this.mAction=o.mAction;this.mData=o.mData;this.mType=o.mType;this.mPackage=o.mPackage;this.mComponent=o.mComponent;this.mFlags=o.mFlags;if(o.mCategories!=null){this.mCategories=newHashSet(o.mCategories);}if(o.mExtras!=null){this.mExtras=newBundle(o.mExtras);}if(o.mSourceBounds!=null){this.mSourceBounds=newRect(o.mSourceBounds);}if(o.mSelector!=null){this.mSelector=newIntent(o.mSelector);}if(o.mClipData!=null){this.mClipData=newClipData(o.mClipData);}}@OverridepublicObjectclone(){returnnewIntent(this);}privateIntent(Intento,booleanall){this.mAction=o.mAction;this.mData=o.mData;this.mType=o.mType;this.mPackage=o.mPackage;this.mComponent=o.mComponent;if(o.mCategories!=null){this.mCategories=newHashSet(o.mCategories);}}/***MakeacloneofonlythepartsoftheIntentthatarerelevantfor*filtermatching:theaction,data,type,component,andcategories.*/publicIntentcloneFilter(){returnnewIntent(this,false);}/***Createanintentwithagivenaction.Allotherfields(data,type,*class)arenull.Notethattheactionmustbeina*namespacebecauseIntentsareusedgloballyinthesystem--for*examplethesystemVIEWactionisandroid.intent.action.VIEW;an*application'scustomactionwouldbesomethinglike*com.google.app.myapp.CUSTOM_ACTION.**@paramactionTheIntentaction,suchasACTION_VIEW.*/publicIntent(Stringaction){setAction(action);}/***Createanintentwithagivenactionandforagivendataurl.Note*thattheactionmustbeinanamespacebecauseIntentsare*usedgloballyinthesystem--forexamplethesystemVIEWactionis*android.intent.action.VIEW;anapplication'scustomactionwouldbe*somethinglikecom.google.app.myapp.CUSTOM_ACTION.**

Note:schemeandhostnamematchingintheAndroidframeworkis*case-sensitive,unliketheformalRFC.Asaresult,*youshouldalwaysensurethatyouwriteyourUriwiththeseelements*usinglowercaseletters,andnormalizeanyUrisyoureceivefrom*outsideofAndroidtoensuretheschemeandhostislowercase.

**@paramactionTheIntentaction,suchasACTION_VIEW.*@paramuriTheIntentdataURI.*/publicIntent(Stringaction,Uriuri){setAction(action);mData=uri;}/***Createanintentforaspecificcomponent.Allotherfields(action,data,*type,class)arenull,thoughtheycanbemodifiedlaterwithexplicit*calls.Thisprovidesaconvenientwaytocreateanintentthatis*intendedtoexecuteahard-codedclassname,ratherthanrelyingonthe*systemtofindanappropriateclassforyou;see{@link#setComponent}*formoreinformationontherepercussionsofthis.**@parampackageContextAContextoftheapplicationpackageimplementing*thisclass.*@paramclsThecomponentclassthatistobeusedfortheintent.**@see#setClass*@see#setComponent*@see#Intent(String,android.net.Uri,Context,Class)*/publicIntent(ContextpackageContext,Class>cls){mComponent=newComponentName(packageContext,cls);}/***Createanintentforaspecificcomponentwithaspecifiedactionanddata.*Thisisequivalentusing{@link#Intent(String,android.net.Uri)}to*constructtheIntentandthencalling{@link#setClass}tosetits*class.**

Note:schemeandhostnamematchingintheAndroidframeworkis*case-sensitive,unliketheformalRFC.Asaresult,*youshouldalwaysensurethatyouwriteyourUriwiththeseelements*usinglowercaseletters,andnormalizeanyUrisyoureceivefrom*outsideofAndroidtoensuretheschemeandhostislowercase.

**@paramactionTheIntentaction,suchasACTION_VIEW.*@paramuriTheIntentdataURI.*@parampackageContextAContextoftheapplicationpackageimplementing*thisclass.*@paramclsThecomponentclassthatistobeusedfortheintent.**@see#Intent(String,android.net.Uri)*@see#Intent(Context,Class)*@see#setClass*@see#setComponent*/publicIntent(Stringaction,Uriuri,ContextpackageContext,Class>cls){setAction(action);mData=uri;mComponent=newComponentName(packageContext,cls);}/***Createanintenttolaunchthemain(root)activityofatask.This*istheIntentthatisstartedwhentheapplication'sislaunchedfrom*Home.Foranythingelsethatwantstolaunchanapplicationinthe*sameway,itisimportantthattheyuseanIntentstructuredthesame*way,andcanusethisfunctiontoensurethisisthecase.**

ThereturnedIntenthasthegivenActivitycomponentasitsexplicit*component,{@link#ACTION_MAIN}asitsaction,andincludesthe*category{@link#CATEGORY_LAUNCHER}.Thisdoesnothave*{@link#FLAG_ACTIVITY_NEW_TASK}set,thoughtypicallyyouwillwant*todothatthrough{@link#addFlags(int)}onthereturnedIntent.**@parammainActivityThemainactivitycomponentthatthisIntentwill*launch.*@returnReturnsanewlycreatedIntentthatcanbeusedtolaunchthe*activityasamainapplicationentry.**@see#setClass*@see#setComponent*/publicstaticIntentmakeMainActivity(ComponentNamemainActivity){Intentintent=newIntent(ACTION_MAIN);intent.setComponent(mainActivity);intent.addCategory(CATEGORY_LAUNCHER);returnintent;}/***MakeanIntentforthemainactivityofanapplication,without*specifyingaspecificactivitytorunbutgivingaselectortofind*theactivity.ThisresultsinafinalIntentthatisstructured*thesameaswhentheapplicationislaunchedfrom*Home.Foranythingelsethatwantstolaunchanapplicationinthe*sameway,itisimportantthattheyuseanIntentstructuredthesame*way,andcanusethisfunctiontoensurethisisthecase.**

ThereturnedIntenthas{@link#ACTION_MAIN}asitsaction,andincludesthe*category{@link#CATEGORY_LAUNCHER}.Thisdoesnothave*{@link#FLAG_ACTIVITY_NEW_TASK}set,thoughtypicallyyouwillwant*todothatthrough{@link#addFlags(int)}onthereturnedIntent.**@paramselectorActionTheactionnameoftheIntent'sselector.*@paramselectorCategoryThenameofacategorytoaddtotheIntent's*selector.*@returnReturnsanewlycreatedIntentthatcanbeusedtolaunchthe*activityasamainapplicationentry.**@see#setSelector(Intent)*/publicstaticIntentmakeMainSelectorActivity(StringselectorAction,StringselectorCategory){Intentintent=newIntent(ACTION_MAIN);intent.addCategory(CATEGORY_LAUNCHER);Intentselector=newIntent();selector.setAction(selectorAction);selector.addCategory(selectorCategory);intent.setSelector(selector);returnintent;}/***MakeanIntentthatcanbeusedtore-launchanapplication'stask*initsbasestate.Thisislike{@link#makeMainActivity(ComponentName)},*butalsosetstheflags{@link#FLAG_ACTIVITY_NEW_TASK}and*{@link#FLAG_ACTIVITY_CLEAR_TASK}.**@parammainActivityTheactivitycomponentthatistherootofthe*task;thisistheactivitythathasbeenpublishedintheapplication's*manifestasthemainlaunchericon.**@returnReturnsanewlycreatedIntentthatcanbeusedtorelaunchthe*activity'staskinitsrootstate.*/publicstaticIntentmakeRestartActivityTask(ComponentNamemainActivity){Intentintent=makeMainActivity(mainActivity);intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TASK);returnintent;}/***Call{@link#parseUri}with0flags.*@deprecatedUse{@link#parseUri}instead.*/@DeprecatedpublicstaticIntentgetIntent(Stringuri)throwsURISyntaxException{returnparseUri(uri,0);}/***CreateanintentfromaURI.ThisURImayencodetheaction,*category,andotherintentfields,ifitwasreturnedby*{@link#toUri}.IftheIntentwasnotgeneratebytoUri(),itsdata*willbetheentireURIanditsactionwillbeACTION_VIEW.**

TheURIgivenheremustnotberelative--thatis,itmustinclude*theschemeandfullpath.**@paramuriTheURItoturnintoanIntent.*@paramflagsAdditionalprocessingflags.Either0or*{@link#URI_INTENT_SCHEME}.**@returnIntentThenewlycreatedIntentobject.**@throwsURISyntaxExceptionThrowsURISyntaxErrorifthebasicURIsyntax*itbad(asparsedbytheUriclass)ortheIntentdatawithinthe*URIisinvalid.**@see#toUri*/publicstaticIntentparseUri(Stringuri,intflags)throwsURISyntaxException{inti=0;try{//Validateintentschemeforifrequested.if((flags&URI_INTENT_SCHEME)!=0){if(!uri.startsWith("intent:")){Intentintent=newIntent(ACTION_VIEW);try{intent.setData(Uri.parse(uri));}catch(IllegalArgumentExceptione){thrownewURISyntaxException(uri,e.getMessage());}returnintent;}}//simplecasei=uri.lastIndexOf("#");if(i==-1)returnnewIntent(ACTION_VIEW,Uri.parse(uri));//oldformatIntentURIif(!uri.startsWith("#Intent;",i))returngetIntentOld(uri);//newformatIntentintent=newIntent(ACTION_VIEW);IntentbaseIntent=intent;//fetchdatapart,ifpresentStringdata=i>=0?uri.substring(0,i):null;Stringscheme=null;i+="#Intent;".length();//loopovercontentsofIntent,allname=value;while(!uri.startsWith("end",i)){inteq=uri.indexOf('=',i);if(eq<0)eq=i-1;intsemi=uri.indexOf(';',i);Stringvalue=eq0){try{intent.mData=Uri.parse(data);}catch(IllegalArgumentExceptione){thrownewURISyntaxException(uri,e.getMessage());}}}returnintent;}catch(IndexOutOfBoundsExceptione){thrownewURISyntaxException(uri,"illegalIntentURIformat",i);}}publicstaticIntentgetIntentOld(Stringuri)throwsURISyntaxException{Intentintent;inti=uri.lastIndexOf('#');if(i>=0){Stringaction=null;finalintintentFragmentStart=i;booleanisIntentFragment=false;i++;if(uri.regionMatches(i,"action(",0,7)){isIntentFragment=true;i+=7;intj=uri.indexOf(')',i);action=uri.substring(i,j);i=j+1;}intent=newIntent(action);if(uri.regionMatches(i,"categories(",0,11)){isIntentFragment=true;i+=11;intj=uri.indexOf(')',i);while(i=0&&sep=closeParen){thrownewURISyntaxException(uri,"EXTRAmissing'='",i);}chartype=uri.charAt(i);i++;Stringkey=uri.substring(i,j);i=j+1;//gettype-valuej=uri.indexOf('!',i);if(j==-1||j>=closeParen)j=closeParen;if(i>=j)thrownewURISyntaxException(uri,"EXTRAmissing'!'",i);Stringvalue=uri.substring(i,j);i=j;//createBundleifitdoesn'talreadyexistif(intent.mExtras==null)intent.mExtras=newBundle();//additemtobundletry{switch(type){case'S':intent.mExtras.putString(key,Uri.decode(value));break;case'B':intent.mExtras.putBoolean(key,Boolean.parseBoolean(value));break;case'b':intent.mExtras.putByte(key,Byte.parseByte(value));break;case'c':intent.mExtras.putChar(key,Uri.decode(value).charAt(0));break;case'd':intent.mExtras.putDouble(key,Double.parseDouble(value));break;case'f':intent.mExtras.putFloat(key,Float.parseFloat(value));break;case'i':intent.mExtras.putInt(key,Integer.parseInt(value));break;case'l':intent.mExtras.putLong(key,Long.parseLong(value));break;case's':intent.mExtras.putShort(key,Short.parseShort(value));break;default:thrownewURISyntaxException(uri,"EXTRAhasunknowntype",i);}}catch(NumberFormatExceptione){thrownewURISyntaxException(uri,"EXTRAvaluecan'tbeparsed",i);}charch=uri.charAt(i);if(ch==')')break;if(ch!='!')thrownewURISyntaxException(uri,"EXTRAmissing'!'",i);i++;}}if(isIntentFragment){intent.mData=Uri.parse(uri.substring(0,intentFragmentStart));}else{intent.mData=Uri.parse(uri);}if(intent.mAction==null){//Bydefault,ifnoactionisspecified,thenuseVIEW.intent.mAction=ACTION_VIEW;}}else{intent=newIntent(ACTION_VIEW,Uri.parse(uri));}returnintent;}/***Retrievethegeneralactiontobeperformed,suchas*{@link#ACTION_VIEW}.Theactiondescribesthegeneralwaytherestof*theinformationintheintentshouldbeinterpreted--mostimportantly,*whattodowiththedatareturnedby{@link#getData}.**@returnTheactionofthisintentornullifnoneisspecified.**@see#setAction*/publicStringgetAction(){returnmAction;}/***Retrievedatathisintentisoperatingon.ThisURIspecifiesthename*ofthedata;oftenitusesthecontent:scheme,specifyingdataina*contentprovider.Otherschemesmaybehandledbyspecificactivities,*suchashttp:bythewebbrowser.**@returnTheURIofthedatathisintentistargetingornull.**@see#getScheme*@see#setData*/publicUrigetData(){returnmData;}/***Thesameas{@link#getData()},butreturnstheURIasanencoded*String.*/publicStringgetDataString(){returnmData!=null?mData.toString():null;}/***Returntheschemeportionoftheintent'sdata.Ifthedataisnullor*doesnotincludeascheme,nullisreturned.Otherwise,thescheme*prefixwithoutthefinal':'isreturned,i.e."http".**

ThisisthesameascallinggetData().getScheme()(andcheckingfor*nulldata).**@returnTheschemeofthisintent.**@see#getData*/publicStringgetScheme(){returnmData!=null?mData.getScheme():null;}/***RetrieveanyexplicitMIMEtypeincludedintheintent.Thisisusually*null,asthetypeisdeterminedbytheintentdata.**@returnIfatypewasmanuallyset,itisreturned;elsenullis*returned.**@see#resolveType(ContentResolver)*@see#setType*/publicStringgetType(){returnmType;}/***ReturntheMIMEdatatypeofthisintent.Ifthetypefieldis*explicitlyset,thatissimplyreturned.Otherwise,ifthedataisset,*thetypeofthatdataisreturned.Ifneitherfieldsareset,anullis*returned.**@returnTheMIMEtypeofthisintent.**@see#getType*@see#resolveType(ContentResolver)*/publicStringresolveType(Contextcontext){returnresolveType(context.getContentResolver());}/***ReturntheMIMEdatatypeofthisintent.Ifthetypefieldis*explicitlyset,thatissimplyreturned.Otherwise,ifthedataisset,*thetypeofthatdataisreturned.Ifneitherfieldsareset,anullis*returned.**@paramresolverAContentResolverthatcanbeusedtodeterminetheMIME*typeoftheintent'sdata.**@returnTheMIMEtypeofthisintent.**@see#getType*@see#resolveType(Context)*/publicStringresolveType(ContentResolverresolver){if(mType!=null){returnmType;}if(mData!=null){if("content".equals(mData.getScheme())){returnresolver.getType(mData);}}returnnull;}/***ReturntheMIMEdatatypeofthisintent,onlyifitwillbeneededfor*intentresolution.Thisisnotgenerallyusefulforapplicationcode;*itisusedbytheframeworksforcommunicatingwithback-endsystem*services.**@paramresolverAContentResolverthatcanbeusedtodeterminetheMIME*typeoftheintent'sdata.**@returnTheMIMEtypeofthisintent,ornullifitisunknownornot*needed.*/publicStringresolveTypeIfNeeded(ContentResolverresolver){if(mComponent!=null){returnmType;}returnresolveType(resolver);}/***Checkifacategoryexistsintheintent.**@paramcategoryThecategorytocheck.**@returnbooleanTrueiftheintentcontainsthecategory,elsefalse.**@see#getCategories*@see#addCategory*/publicbooleanhasCategory(Stringcategory){returnmCategories!=null&&mCategories.contains(category);}/***Returnthesetofallcategoriesintheintent.Iftherearenocategories,*returnsNULL.**@returnThesetofcategoriesyoucanexamine.Donotmodify!**@see#hasCategory*@see#addCategory*/publicSetgetCategories(){returnmCategories;}/***ReturnthespecificselectorassociatedwiththisIntent.Ifthereis*none,returnsnull.See{@link#setSelector}formoreinformation.**@see#setSelector*/publicIntentgetSelector(){returnmSelector;}/***Returnthe{@linkClipData}associatedwiththisIntent.Ifthereis*none,returnsnull.See{@link#setClipData}formoreinformation.**@see#setClipData;*/publicClipDatagetClipData(){returnmClipData;}/***SetstheClassLoaderthatwillbeusedwhenunmarshalling*anyParcelablevaluesfromtheextrasofthisIntent.**@paramloaderaClassLoader,ornulltousethedefaultloader*atthetimeofunmarshalling.*/publicvoidsetExtrasClassLoader(ClassLoaderloader){if(mExtras!=null){mExtras.setClassLoader(loader);}}/***Returnstrueifanextravalueisassociatedwiththegivenname.*@paramnametheextra'sname*@returntrueifthegivenextraispresent.*/publicbooleanhasExtra(Stringname){returnmExtras!=null&&mExtras.containsKey(name);}/***ReturnstrueiftheIntent'sextrascontainaparcelledfiledescriptor.*@returntrueiftheIntentcontainsaparcelledfiledescriptor.*/publicbooleanhasFileDescriptors(){returnmExtras!=null&&mExtras.hasFileDescriptors();}/**@hide*/publicvoidsetAllowFds(booleanallowFds){if(mExtras!=null){mExtras.setAllowFds(allowFds);}}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*ornullifnonewasfound.**@deprecated*@hide*/@DeprecatedpublicObjectgetExtra(Stringname){returngetExtra(name,null);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.*@paramdefaultValuethevaluetobereturnedifnovalueofthedesired*typeisstoredwiththegivenname.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*orthedefaultvalueifnonewasfound.**@see#putExtra(String,boolean)*/publicbooleangetBooleanExtra(Stringname,booleandefaultValue){returnmExtras==null?defaultValue:mExtras.getBoolean(name,defaultValue);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.*@paramdefaultValuethevaluetobereturnedifnovalueofthedesired*typeisstoredwiththegivenname.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*orthedefaultvalueifnonewasfound.**@see#putExtra(String,byte)*/publicbytegetByteExtra(Stringname,bytedefaultValue){returnmExtras==null?defaultValue:mExtras.getByte(name,defaultValue);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.*@paramdefaultValuethevaluetobereturnedifnovalueofthedesired*typeisstoredwiththegivenname.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*orthedefaultvalueifnonewasfound.**@see#putExtra(String,short)*/publicshortgetShortExtra(Stringname,shortdefaultValue){returnmExtras==null?defaultValue:mExtras.getShort(name,defaultValue);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.*@paramdefaultValuethevaluetobereturnedifnovalueofthedesired*typeisstoredwiththegivenname.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*orthedefaultvalueifnonewasfound.**@see#putExtra(String,char)*/publicchargetCharExtra(Stringname,chardefaultValue){returnmExtras==null?defaultValue:mExtras.getChar(name,defaultValue);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.*@paramdefaultValuethevaluetobereturnedifnovalueofthedesired*typeisstoredwiththegivenname.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*orthedefaultvalueifnonewasfound.**@see#putExtra(String,int)*/publicintgetIntExtra(Stringname,intdefaultValue){returnmExtras==null?defaultValue:mExtras.getInt(name,defaultValue);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.*@paramdefaultValuethevaluetobereturnedifnovalueofthedesired*typeisstoredwiththegivenname.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*orthedefaultvalueifnonewasfound.**@see#putExtra(String,long)*/publiclonggetLongExtra(Stringname,longdefaultValue){returnmExtras==null?defaultValue:mExtras.getLong(name,defaultValue);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.*@paramdefaultValuethevaluetobereturnedifnovalueofthedesired*typeisstoredwiththegivenname.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra(),*orthedefaultvalueifnosuchitemispresent**@see#putExtra(String,float)*/publicfloatgetFloatExtra(Stringname,floatdefaultValue){returnmExtras==null?defaultValue:mExtras.getFloat(name,defaultValue);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.*@paramdefaultValuethevaluetobereturnedifnovalueofthedesired*typeisstoredwiththegivenname.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*orthedefaultvalueifnonewasfound.**@see#putExtra(String,double)*/publicdoublegetDoubleExtra(Stringname,doubledefaultValue){returnmExtras==null?defaultValue:mExtras.getDouble(name,defaultValue);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*ornullifnoStringvaluewasfound.**@see#putExtra(String,String)*/publicStringgetStringExtra(Stringname){returnmExtras==null?null:mExtras.getString(name);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*ornullifnoCharSequencevaluewasfound.**@see#putExtra(String,CharSequence)*/publicCharSequencegetCharSequenceExtra(Stringname){returnmExtras==null?null:mExtras.getCharSequence(name);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*ornullifnoParcelablevaluewasfound.**@see#putExtra(String,Parcelable)*/publicTgetParcelableExtra(Stringname){returnmExtras==null?null:mExtras.getParcelable(name);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*ornullifnoParcelable[]valuewasfound.**@see#putExtra(String,Parcelable[])*/publicParcelable[]getParcelableArrayExtra(Stringname){returnmExtras==null?null:mExtras.getParcelableArray(name);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*ornullifnoArrayListvaluewasfound.**@see#putParcelableArrayListExtra(String,ArrayList)*/publicArrayListgetParcelableArrayListExtra(Stringname){returnmExtras==null?null:mExtras.getParcelableArrayList(name);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*ornullifnoSerializablevaluewasfound.**@see#putExtra(String,Serializable)*/publicSerializablegetSerializableExtra(Stringname){returnmExtras==null?null:mExtras.getSerializable(name);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*ornullifnoArrayListvaluewasfound.**@see#putIntegerArrayListExtra(String,ArrayList)*/publicArrayListgetIntegerArrayListExtra(Stringname){returnmExtras==null?null:mExtras.getIntegerArrayList(name);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*ornullifnoArrayListvaluewasfound.**@see#putStringArrayListExtra(String,ArrayList)*/publicArrayListgetStringArrayListExtra(Stringname){returnmExtras==null?null:mExtras.getStringArrayList(name);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*ornullifnoArrayListvaluewasfound.**@see#putCharSequenceArrayListExtra(String,ArrayList)*/publicArrayListgetCharSequenceArrayListExtra(Stringname){returnmExtras==null?null:mExtras.getCharSequenceArrayList(name);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*ornullifnobooleanarrayvaluewasfound.**@see#putExtra(String,boolean[])*/publicboolean[]getBooleanArrayExtra(Stringname){returnmExtras==null?null:mExtras.getBooleanArray(name);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*ornullifnobytearrayvaluewasfound.**@see#putExtra(String,byte[])*/publicbyte[]getByteArrayExtra(Stringname){returnmExtras==null?null:mExtras.getByteArray(name);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*ornullifnoshortarrayvaluewasfound.**@see#putExtra(String,short[])*/publicshort[]getShortArrayExtra(Stringname){returnmExtras==null?null:mExtras.getShortArray(name);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*ornullifnochararrayvaluewasfound.**@see#putExtra(String,char[])*/publicchar[]getCharArrayExtra(Stringname){returnmExtras==null?null:mExtras.getCharArray(name);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*ornullifnointarrayvaluewasfound.**@see#putExtra(String,int[])*/publicint[]getIntArrayExtra(Stringname){returnmExtras==null?null:mExtras.getIntArray(name);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*ornullifnolongarrayvaluewasfound.**@see#putExtra(String,long[])*/publiclong[]getLongArrayExtra(Stringname){returnmExtras==null?null:mExtras.getLongArray(name);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*ornullifnofloatarrayvaluewasfound.**@see#putExtra(String,float[])*/publicfloat[]getFloatArrayExtra(Stringname){returnmExtras==null?null:mExtras.getFloatArray(name);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*ornullifnodoublearrayvaluewasfound.**@see#putExtra(String,double[])*/publicdouble[]getDoubleArrayExtra(Stringname){returnmExtras==null?null:mExtras.getDoubleArray(name);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*ornullifnoStringarrayvaluewasfound.**@see#putExtra(String,String[])*/publicString[]getStringArrayExtra(Stringname){returnmExtras==null?null:mExtras.getStringArray(name);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*ornullifnoCharSequencearrayvaluewasfound.**@see#putExtra(String,CharSequence[])*/publicCharSequence[]getCharSequenceArrayExtra(Stringname){returnmExtras==null?null:mExtras.getCharSequenceArray(name);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*ornullifnoBundlevaluewasfound.**@see#putExtra(String,Bundle)*/publicBundlegetBundleExtra(Stringname){returnmExtras==null?null:mExtras.getBundle(name);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*ornullifnoIBindervaluewasfound.**@see#putExtra(String,IBinder)**@deprecated*@hide*/@DeprecatedpublicIBindergetIBinderExtra(Stringname){returnmExtras==null?null:mExtras.getIBinder(name);}/***Retrieveextendeddatafromtheintent.**@paramnameThenameofthedesireditem.*@paramdefaultValueThedefaultvaluetoreturnincasenoitemis*associatedwiththekey'name'**@returnthevalueofanitemthatpreviouslyaddedwithputExtra()*ordefaultValueifnonewasfound.**@see#putExtra**@deprecated*@hide*/@DeprecatedpublicObjectgetExtra(Stringname,ObjectdefaultValue){Objectresult=defaultValue;if(mExtras!=null){Objectresult2=mExtras.get(name);if(result2!=null){result=result2;}}returnresult;}/***Retrievesamapofextendeddatafromtheintent.**@returnthemapofallextraspreviouslyaddedwithputExtra(),*ornullifnonehavebeenadded.*/publicBundlegetExtras(){return(mExtras!=null)?newBundle(mExtras):null;}/***Retrieveanyspecialflagsassociatedwiththisintent.Youwill*normallyjustsetthemwith{@link#setFlags}andletthesystem*taketheappropriateactionwiththem.**@returnintThecurrentlysetflags.**@see#setFlags*/publicintgetFlags(){returnmFlags;}/**@hide*/publicbooleanisExcludingStopped(){return(mFlags&(FLAG_EXCLUDE_STOPPED_PACKAGES|FLAG_INCLUDE_STOPPED_PACKAGES))==FLAG_EXCLUDE_STOPPED_PACKAGES;}/***RetrievetheapplicationpackagenamethisIntentislimitedto.When*resolvinganIntent,ifnon-nullthislimitstheresolutiontoonly*componentsinthegivenapplicationpackage.**@returnThenameoftheapplicationpackagefortheIntent.**@see#resolveActivity*@see#setPackage*/publicStringgetPackage(){returnmPackage;}/***Retrievetheconcretecomponentassociatedwiththeintent.Whenreceiving*anintent,thisisthecomponentthatwasfoundtobesthandleit(thatis,*yourself)andwillalwaysbenon-null;inallothercasesitwillbe*nullunlessexplicitlyset.**@returnThenameoftheapplicationcomponenttohandletheintent.**@see#resolveActivity*@see#setComponent*/publicComponentNamegetComponent(){returnmComponent;}/***Gettheboundsofthesenderofthisintent,inscreencoordinates.Thiscanbe*usedasahinttothereceiverforanimationsandthelike.Nullmeansthatthere*isnosourcebounds.*/publicRectgetSourceBounds(){returnmSourceBounds;}/***ReturntheActivitycomponentthatshouldbeusedtohandlethisintent.*Theappropriatecomponentisdeterminedbasedontheinformationinthe*intent,evaluatedasfollows:**

If{@link#getComponent}returnsanexplicitclass,thatisreturned*withoutanyfurtherconsideration.**

Theactivitymusthandlethe{@linkIntent#CATEGORY_DEFAULT}Intent*categorytobeconsidered.**

If{@link#getAction}isnon-NULL,theactivitymusthandlethis*action.**

If{@link#resolveType}returnsnon-NULL,theactivitymusthandle*thistype.**

If{@link#addCategory}hasaddedanycategories,theactivitymust*handleALLofthecategoriesspecified.**

If{@link#getPackage}isnon-NULL,onlyactivitycomponentsin*thatapplicationpackagewillbeconsidered.**

Iftherearenoactivitiesthatsatisfyalloftheseconditions,a*nullstringisreturned.**

Ifmultipleactivitiesarefoundtosatisfytheintent,theonewith*thehighestprioritywillbeused.Iftherearemultipleactivities*withthesamepriority,thesystemwilleitherpickthebestactivity*basedonuserpreference,orresolvetoasystemclassthatwillallow*theusertopickanactivityandforwardfromthere.**

Thismethodisimplementedsimplybycalling*{@linkPackageManager#resolveActivity}withthe"defaultOnly"parameter*true.

*

ThisAPIiscalledforyouaspartofstartinganactivityfroman*intent.Youdonotnormallyneedtocallityourself.

**@parampmThepackagemanagerwithwhichtoresolvetheIntent.**@returnNameofthecomponentimplementinganactivitythatcan*displaytheintent.**@see#setComponent*@see#getComponent*@see#resolveActivityInfo*/publicComponentNameresolveActivity(PackageManagerpm){if(mComponent!=null){returnmComponent;}ResolveInfoinfo=pm.resolveActivity(this,PackageManager.MATCH_DEFAULT_ONLY);if(info!=null){returnnewComponentName(info.activityInfo.applicationInfo.packageName,info.activityInfo.name);}returnnull;}/***ResolvetheIntentintoan{@linkActivityInfo}*describingtheactivitythatshouldexecutetheintent.Resolution*followsthesamerulesasdescribedfor{@link#resolveActivity},but*yougetbackthecompletelyinformationabouttheresolvedactivity*insteadofjustitsclassname.**@parampmThepackagemanagerwithwhichtoresolvetheIntent.*@paramflagsAdditioninformationtoretrieveasper*{@linkPackageManager#getActivityInfo(ComponentName,int)*PackageManager.getActivityInfo()}.**@returnPackageManager.ActivityInfo**@see#resolveActivity*/publicActivityInforesolveActivityInfo(PackageManagerpm,intflags){ActivityInfoai=null;if(mComponent!=null){try{ai=pm.getActivityInfo(mComponent,flags);}catch(PackageManager.NameNotFoundExceptione){//ignore}}else{ResolveInfoinfo=pm.resolveActivity(this,PackageManager.MATCH_DEFAULT_ONLY|flags);if(info!=null){ai=info.activityInfo;}}returnai;}/***Setthegeneralactiontobeperformed.**@paramactionAnactionname,suchasACTION_VIEW.Application-specific*actionsshouldbeprefixedwiththevendor'spackagename.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#getAction*/publicIntentsetAction(Stringaction){mAction=action!=null?action.intern():null;returnthis;}/***Setthedatathisintentisoperatingon.Thismethodautomatically*clearsanytypethatwaspreviouslysetby{@link#setType}or*{@link#setTypeAndNormalize}.**

Note:schemematchingintheAndroidframeworkis*case-sensitive,unliketheformalRFC.Asaresult,*youshouldalwayswriteyourUriwithalowercasescheme,*oruse{@linkUri#normalize}or*{@link#setDataAndNormalize}*toensurethattheschemeisconvertedtolowercase.**@paramdataTheUriofthedatathisintentisnowtargeting.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#getData*@see#setDataAndNormalize*@seeandroid.net.Intent#normalize*/publicIntentsetData(Uridata){mData=data;mType=null;returnthis;}/***Normalizeandsetthedatathisintentisoperatingon.**

Thismethodautomaticallyclearsanytypethatwas*previouslyset(forexample,by{@link#setType}).**

ThedataUriisnormalizedusing*{@linkandroid.net.Uri#normalize}beforeitisset,*soreallythisisjustaconveniencemethodfor*

*setData(data.normalize())*
**@paramdataTheUriofthedatathisintentisnowtargeting.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#getData*@see#setType*@seeandroid.net.Uri#normalize*/publicIntentsetDataAndNormalize(Uridata){returnsetData(data.normalize());}/***SetanexplicitMIMEdatatype.**

Thisisusedtocreateintentsthatonlyspecifyatypeandnotdata,*forexampletoindicatethetypeofdatatoreturn.**

Thismethodautomaticallyclearsanydatathatwas*previouslyset(forexampleby{@link#setData}).**

Note:MIMEtypematchingintheAndroidframeworkis*case-sensitive,unlikeformalRFCMIMEtypes.Asaresult,*youshouldalwayswriteyourMIMEtypeswithlowercaseletters,*oruse{@link#normalizeMimeType}or{@link#setTypeAndNormalize}*toensurethatitisconvertedtolowercase.**@paramtypeTheMIMEtypeofthedatabeinghandledbythisintent.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#getType*@see#setTypeAndNormalize*@see#setDataAndType*@see#normalizeMimeType*/publicIntentsetType(Stringtype){mData=null;mType=type;returnthis;}/***NormalizeandsetanexplicitMIMEdatatype.**

Thisisusedtocreateintentsthatonlyspecifyatypeandnotdata,*forexampletoindicatethetypeofdatatoreturn.**

Thismethodautomaticallyclearsanydatathatwas*previouslyset(forexampleby{@link#setData}).**

TheMIMEtypeisnormalizedusing*{@link#normalizeMimeType}beforeitisset,*soreallythisisjustaconveniencemethodfor*

*setType(Intent.normalizeMimeType(type))*
**@paramtypeTheMIMEtypeofthedatabeinghandledbythisintent.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#getType*@see#setData*@see#normalizeMimeType*/publicIntentsetTypeAndNormalize(Stringtype){returnsetType(normalizeMimeType(type));}/***(Usuallyoptional)Setthedatafortheintentalongwithanexplicit*MIMEdatatype.Thismethodshouldveryrarelybeused--itallowsyou*tooverridetheMIMEtypethatwouldordinarilybeinferredfromthe*datawithyourowntypegivenhere.**

Note:MIMEtypeandUrischemematchinginthe*Androidframeworkiscase-sensitive,unliketheformalRFCdefinitions.*Asaresult,youshouldalwayswritetheseelementswithlowercaseletters,*oruse{@link#normalizeMimeType}or{@linkandroid.net.Uri#normalize}or*{@link#setDataAndTypeAndNormalize}*toensurethattheyareconvertedtolowercase.**@paramdataTheUriofthedatathisintentisnowtargeting.*@paramtypeTheMIMEtypeofthedatabeinghandledbythisintent.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#setType*@see#setData*@see#normalizeMimeType*@seeandroid.net.Uri#normalize*@see#setDataAndTypeAndNormalize*/publicIntentsetDataAndType(Uridata,Stringtype){mData=data;mType=type;returnthis;}/***(Usuallyoptional)NormalizeandsetboththedataUriandanexplicit*MIMEdatatype.Thismethodshouldveryrarelybeused--itallowsyou*tooverridetheMIMEtypethatwouldordinarilybeinferredfromthe*datawithyourowntypegivenhere.**

ThedataUriandtheMIMEtypearenormalizeusing*{@linkandroid.net.Uri#normalize}and{@link#normalizeMimeType}*beforetheyareset,soreallythisisjustaconveniencemethodfor*

*setDataAndType(data.normalize(),Intent.normalizeMimeType(type))*
**@paramdataTheUriofthedatathisintentisnowtargeting.*@paramtypeTheMIMEtypeofthedatabeinghandledbythisintent.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#setType*@see#setData*@see#setDataAndType*@see#normalizeMimeType*@seeandroid.net.Uri#normalize*/publicIntentsetDataAndTypeAndNormalize(Uridata,Stringtype){returnsetDataAndType(data.normalize(),normalizeMimeType(type));}/***Addanewcategorytotheintent.Categoriesprovideadditionaldetail*abouttheactiontheintentperforms.Whenresolvinganintent,only*activitiesthatprovidealloftherequestedcategorieswillbe*used.**@paramcategoryThedesiredcategory.Thiscanbeeitheroneofthe*predefinedIntentcategories,oracustomcategoryinyourown*namespace.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#hasCategory*@see#removeCategory*/publicIntentaddCategory(Stringcategory){if(mCategories==null){mCategories=newHashSet();}mCategories.add(category.intern());returnthis;}/***Removeacategoryfromanintent.**@paramcategoryThecategorytoremove.**@see#addCategory*/publicvoidremoveCategory(Stringcategory){if(mCategories!=null){mCategories.remove(category);if(mCategories.size()==0){mCategories=null;}}}/***SetaselectorforthisIntent.Thisisamodificationtothekindsof*thingstheIntentwillmatch.Iftheselectorisset,itwillbeused*whentryingtofindentitiesthatcanhandletheIntent,insteadofthe*maincontentsoftheIntent.ThisallowsyoubuildanIntentcontaining*agenericprotocolwhiletargetingitmorespecifically.**

Anexampleofwherethismaybeusediswiththingslike*{@link#CATEGORY_APP_BROWSER}.Thiscategoryallowsyoutobuildan*IntentthatwilllaunchtheBrowserapplication.However,thecorrect*mainentrypointofanapplicationisactually{@link#ACTION_MAIN}*{@link#CATEGORY_LAUNCHER}with{@link#setComponent(ComponentName)}*usedtospecifytheactualActivitytolaunch.Ifyoulaunchthebrowser*withsomethingdifferent,undesiredbehaviormayhappeniftheuserhas*previouslyorlaterlaunchesitthenormalway,sincetheydonotmatch.*Instead,youcanbuildanIntentwiththeMAINaction(butnoComponentName*yetspecified)andsetaselectorwith{@link#ACTION_MAIN}and*{@link#CATEGORY_APP_BROWSER}topointitspecificallytothebrowseractivity.**

Settingaselectordoesnotimpactthebehaviorof*{@link#filterEquals(Intent)}and{@link#filterHashCode()}.Thisispartofthe*desiredbehaviorofaselector--itdoesnotimpactthebasemeaning*oftheIntent,justwhatkindsofthingswillbematchedagainstit*whendeterminingwhocanhandleit.

**

Youcannotusebothaselectorand{@link#setPackage(String)}on*thesamebaseIntent.

**@paramselectorThedesiredselectorIntent;settonulltonotuse*aspecialselector.*/publicvoidsetSelector(Intentselector){if(selector==this){thrownewIllegalArgumentException("Intentbeingsetasaselectorofitself");}if(selector!=null&&mPackage!=null){thrownewIllegalArgumentException("Can'tsetselectorwhenpackagenameisalreadyset");}mSelector=selector;}/***Seta{@linkClipData}associatedwiththisIntent.Thisreplacesany*previouslysetClipData.**

TheClipDatainanintentisnotusedforIntentmatchingorother*suchoperations.Semanticallyitislikeextras,usedtotransmit*additionaldatawiththeIntent.Themainfeatureofusingthisover*theextrasfordataisthat{@link#FLAG_GRANT_READ_URI_PERMISSION}*and{@link#FLAG_GRANT_WRITE_URI_PERMISSION}willoperateonanyURI*itemsincludedintheclipdata.Thisisuseful,inparticular,if*youwanttotransmitanIntentcontainingmultiplecontent:*URIsforwhichtherecipientmaynothaveglobalpermissiontoaccessthe*contentprovider.**

IftheClipDatacontainsitemsthatarethemselvesIntents,any*grantflagsinthoseIntentswillbeignored.Onlythetop-levelflags*ofthemainIntentarerespected,andwillbeappliedtoallUrior*Intentitemsintheclip(orsub-itemsoftheclip).**

TheMIMEtype,label,andiconintheClipDataobjectarenot*directlyusedbyIntent.Applicationsshouldgenerallyrelyonthe*MIMEtypeoftheIntentitself,notwhatitmayfindintheClipData.*AcommonpracticeistoconstructaClipDataforusewithanIntent*withaMIMEtypeof"*\/*".**@paramclipThenewcliptoset.Maybenulltoclearthecurrentclip.*/publicvoidsetClipData(ClipDataclip){mClipData=clip;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueThebooleandatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getBooleanExtra(String,boolean)*/publicIntentputExtra(Stringname,booleanvalue){if(mExtras==null){mExtras=newBundle();}mExtras.putBoolean(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueThebytedatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getByteExtra(String,byte)*/publicIntentputExtra(Stringname,bytevalue){if(mExtras==null){mExtras=newBundle();}mExtras.putByte(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueThechardatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getCharExtra(String,char)*/publicIntentputExtra(Stringname,charvalue){if(mExtras==null){mExtras=newBundle();}mExtras.putChar(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueTheshortdatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getShortExtra(String,short)*/publicIntentputExtra(Stringname,shortvalue){if(mExtras==null){mExtras=newBundle();}mExtras.putShort(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueTheintegerdatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getIntExtra(String,int)*/publicIntentputExtra(Stringname,intvalue){if(mExtras==null){mExtras=newBundle();}mExtras.putInt(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueThelongdatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getLongExtra(String,long)*/publicIntentputExtra(Stringname,longvalue){if(mExtras==null){mExtras=newBundle();}mExtras.putLong(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueThefloatdatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getFloatExtra(String,float)*/publicIntentputExtra(Stringname,floatvalue){if(mExtras==null){mExtras=newBundle();}mExtras.putFloat(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueThedoubledatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getDoubleExtra(String,double)*/publicIntentputExtra(Stringname,doublevalue){if(mExtras==null){mExtras=newBundle();}mExtras.putDouble(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueTheStringdatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getStringExtra(String)*/publicIntentputExtra(Stringname,Stringvalue){if(mExtras==null){mExtras=newBundle();}mExtras.putString(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueTheCharSequencedatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getCharSequenceExtra(String)*/publicIntentputExtra(Stringname,CharSequencevalue){if(mExtras==null){mExtras=newBundle();}mExtras.putCharSequence(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueTheParcelabledatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getParcelableExtra(String)*/publicIntentputExtra(Stringname,Parcelablevalue){if(mExtras==null){mExtras=newBundle();}mExtras.putParcelable(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueTheParcelable[]datavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getParcelableArrayExtra(String)*/publicIntentputExtra(Stringname,Parcelable[]value){if(mExtras==null){mExtras=newBundle();}mExtras.putParcelableArray(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueTheArrayListdatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getParcelableArrayListExtra(String)*/publicIntentputParcelableArrayListExtra(Stringname,ArrayListvalue){if(mExtras==null){mExtras=newBundle();}mExtras.putParcelableArrayList(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueTheArrayListdatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getIntegerArrayListExtra(String)*/publicIntentputIntegerArrayListExtra(Stringname,ArrayListvalue){if(mExtras==null){mExtras=newBundle();}mExtras.putIntegerArrayList(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueTheArrayListdatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getStringArrayListExtra(String)*/publicIntentputStringArrayListExtra(Stringname,ArrayListvalue){if(mExtras==null){mExtras=newBundle();}mExtras.putStringArrayList(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueTheArrayListdatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getCharSequenceArrayListExtra(String)*/publicIntentputCharSequenceArrayListExtra(Stringname,ArrayListvalue){if(mExtras==null){mExtras=newBundle();}mExtras.putCharSequenceArrayList(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueTheSerializabledatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getSerializableExtra(String)*/publicIntentputExtra(Stringname,Serializablevalue){if(mExtras==null){mExtras=newBundle();}mExtras.putSerializable(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueThebooleanarraydatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getBooleanArrayExtra(String)*/publicIntentputExtra(Stringname,boolean[]value){if(mExtras==null){mExtras=newBundle();}mExtras.putBooleanArray(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueThebytearraydatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getByteArrayExtra(String)*/publicIntentputExtra(Stringname,byte[]value){if(mExtras==null){mExtras=newBundle();}mExtras.putByteArray(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueTheshortarraydatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getShortArrayExtra(String)*/publicIntentputExtra(Stringname,short[]value){if(mExtras==null){mExtras=newBundle();}mExtras.putShortArray(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueThechararraydatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getCharArrayExtra(String)*/publicIntentputExtra(Stringname,char[]value){if(mExtras==null){mExtras=newBundle();}mExtras.putCharArray(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueTheintarraydatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getIntArrayExtra(String)*/publicIntentputExtra(Stringname,int[]value){if(mExtras==null){mExtras=newBundle();}mExtras.putIntArray(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueThebytearraydatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getLongArrayExtra(String)*/publicIntentputExtra(Stringname,long[]value){if(mExtras==null){mExtras=newBundle();}mExtras.putLongArray(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueThefloatarraydatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getFloatArrayExtra(String)*/publicIntentputExtra(Stringname,float[]value){if(mExtras==null){mExtras=newBundle();}mExtras.putFloatArray(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueThedoublearraydatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getDoubleArrayExtra(String)*/publicIntentputExtra(Stringname,double[]value){if(mExtras==null){mExtras=newBundle();}mExtras.putDoubleArray(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueTheStringarraydatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getStringArrayExtra(String)*/publicIntentputExtra(Stringname,String[]value){if(mExtras==null){mExtras=newBundle();}mExtras.putStringArray(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueTheCharSequencearraydatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getCharSequenceArrayExtra(String)*/publicIntentputExtra(Stringname,CharSequence[]value){if(mExtras==null){mExtras=newBundle();}mExtras.putCharSequenceArray(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueTheBundledatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getBundleExtra(String)*/publicIntentputExtra(Stringname,Bundlevalue){if(mExtras==null){mExtras=newBundle();}mExtras.putBundle(name,value);returnthis;}/***Addextendeddatatotheintent.Thenamemustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramnameThenameoftheextradata,withpackageprefix.*@paramvalueTheIBinderdatavalue.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#putExtras*@see#removeExtra*@see#getIBinderExtra(String)**@deprecated*@hide*/@DeprecatedpublicIntentputExtra(Stringname,IBindervalue){if(mExtras==null){mExtras=newBundle();}mExtras.putIBinder(name,value);returnthis;}/***Copyallextrasin'src'intothisintent.**@paramsrcContainstheextrastocopy.**@see#putExtra*/publicIntentputExtras(Intentsrc){if(src.mExtras!=null){if(mExtras==null){mExtras=newBundle(src.mExtras);}else{mExtras.putAll(src.mExtras);}}returnthis;}/***Addasetofextendeddatatotheintent.Thekeysmustincludeapackage*prefix,forexampletheappcom.android.contactswouldusenames*like"com.android.contacts.ShowAll".**@paramextrasTheBundleofextrastoaddtothisintent.**@see#putExtra*@see#removeExtra*/publicIntentputExtras(Bundleextras){if(mExtras==null){mExtras=newBundle();}mExtras.putAll(extras);returnthis;}/***CompletelyreplacetheextrasintheIntentwiththeextrasinthe*givenIntent.**@paramsrcTheexactextrascontainedinthisIntentarecopied*intothetargetintent,replacinganythatwerepreviouslythere.*/publicIntentreplaceExtras(Intentsrc){mExtras=src.mExtras!=null?newBundle(src.mExtras):null;returnthis;}/***CompletelyreplacetheextrasintheIntentwiththegivenBundleof*extras.**@paramextrasThenewsetofextrasintheIntent,ornulltoerase*allextras.*/publicIntentreplaceExtras(Bundleextras){mExtras=extras!=null?newBundle(extras):null;returnthis;}/***Removeextendeddatafromtheintent.**@see#putExtra*/publicvoidremoveExtra(Stringname){if(mExtras!=null){mExtras.remove(name);if(mExtras.size()==0){mExtras=null;}}}/***Setspecialflagscontrollinghowthisintentishandled.Mostvalues*heredependonthetypeofcomponentbeingexecutedbytheIntent,*specificallytheFLAG_ACTIVITY_*flagsareallforusewith*{@linkContext#startActivityContext.startActivity()}andthe*FLAG_RECEIVER_*flagsareallforusewith*{@linkContext#sendBroadcast(Intent)Context.sendBroadcast()}.**

Seethe*TasksandBack*Stackdocumentationforimportantinformationonhowsomeoftheseoptionsimpact*thebehaviorofyourapplication.**@paramflagsThedesiredflags.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#getFlags*@see#addFlags**@see#FLAG_GRANT_READ_URI_PERMISSION*@see#FLAG_GRANT_WRITE_URI_PERMISSION*@see#FLAG_DEBUG_LOG_RESOLUTION*@see#FLAG_FROM_BACKGROUND*@see#FLAG_ACTIVITY_BROUGHT_TO_FRONT*@see#FLAG_ACTIVITY_CLEAR_TASK*@see#FLAG_ACTIVITY_CLEAR_TOP*@see#FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET*@see#FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS*@see#FLAG_ACTIVITY_FORWARD_RESULT*@see#FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY*@see#FLAG_ACTIVITY_MULTIPLE_TASK*@see#FLAG_ACTIVITY_NEW_TASK*@see#FLAG_ACTIVITY_NO_ANIMATION*@see#FLAG_ACTIVITY_NO_HISTORY*@see#FLAG_ACTIVITY_NO_USER_ACTION*@see#FLAG_ACTIVITY_PREVIOUS_IS_TOP*@see#FLAG_ACTIVITY_RESET_TASK_IF_NEEDED*@see#FLAG_ACTIVITY_REORDER_TO_FRONT*@see#FLAG_ACTIVITY_SINGLE_TOP*@see#FLAG_ACTIVITY_TASK_ON_HOME*@see#FLAG_RECEIVER_REGISTERED_ONLY*/publicIntentsetFlags(intflags){mFlags=flags;returnthis;}/***Addadditionalflagstotheintent(orwithexistingflags*value).**@paramflagsThenewflagstoset.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#setFlags*/publicIntentaddFlags(intflags){mFlags|=flags;returnthis;}/***(Usuallyoptional)Setanexplicitapplicationpackagenamethatlimits*thecomponentsthisIntentwillresolveto.Iflefttothedefault*valueofnull,allcomponentsinallapplicationswillconsidered.*Ifnon-null,theIntentcanonlymatchthecomponentsinthegiven*applicationpackage.**@parampackageNameThenameoftheapplicationpackagetohandlethe*intent,ornulltoallowanyapplicationpackage.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#getPackage*@see#resolveActivity*/publicIntentsetPackage(StringpackageName){if(packageName!=null&&mSelector!=null){thrownewIllegalArgumentException("Can'tsetpackagenamewhenselectorisalreadyset");}mPackage=packageName;returnthis;}/***(Usuallyoptional)Explicitlysetthecomponenttohandletheintent.*Ifleftwiththedefaultvalueofnull,thesystemwilldeterminethe*appropriateclasstousebasedontheotherfields(action,data,*type,categories)intheIntent.Ifthisclassisdefined,the*specifiedclasswillalwaysbeusedregardlessoftheotherfields.You*shouldonlysetthisvaluewhenyouknowyouabsolutelywantaspecific*classtobeused;otherwiseitisbettertoletthesystemfindthe*appropriateclasssothatyouwillrespecttheinstalledapplications*anduserpreferences.**@paramcomponentThenameoftheapplicationcomponenttohandlethe*intent,ornulltoletthesystemfindoneforyou.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#setClass*@see#setClassName(Context,String)*@see#setClassName(String,String)*@see#getComponent*@see#resolveActivity*/publicIntentsetComponent(ComponentNamecomponent){mComponent=component;returnthis;}/***Convenienceforcalling{@link#setComponent}withan*explicitclassname.**@parampackageContextAContextoftheapplicationpackageimplementing*thisclass.*@paramclassNameThenameofaclassinsideoftheapplicationpackage*thatwillbeusedasthecomponentforthisIntent.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#setComponent*@see#setClass*/publicIntentsetClassName(ContextpackageContext,StringclassName){mComponent=newComponentName(packageContext,className);returnthis;}/***Convenienceforcalling{@link#setComponent}withan*explicitapplicationpackagenameandclassname.**@parampackageNameThenameofthepackageimplementingthedesired*component.*@paramclassNameThenameofaclassinsideoftheapplicationpackage*thatwillbeusedasthecomponentforthisIntent.**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#setComponent*@see#setClass*/publicIntentsetClassName(StringpackageName,StringclassName){mComponent=newComponentName(packageName,className);returnthis;}/***Convenienceforcalling{@link#setComponent(ComponentName)}withthe*namereturnedbya{@linkClass}object.**@parampackageContextAContextoftheapplicationpackageimplementing*thisclass.*@paramclsTheclassnametoset,equivalentto*setClassName(context,cls.getName()).**@returnReturnsthesameIntentobject,forchainingmultiplecalls*intoasinglestatement.**@see#setComponent*/publicIntentsetClass(ContextpackageContext,Class>cls){mComponent=newComponentName(packageContext,cls);returnthis;}/***Settheboundsofthesenderofthisintent,inscreencoordinates.Thiscanbe*usedasahinttothereceiverforanimationsandthelike.Nullmeansthatthere*isnosourcebounds.*/publicvoidsetSourceBounds(Rectr){if(r!=null){mSourceBounds=newRect(r);}else{mSourceBounds=null;}}/***Usewith{@link#fillIn}toallowthecurrentactionvaluetobe*overwritten,evenifitisalreadyset.*/publicstaticfinalintFILL_IN_ACTION=1<<0;/***Usewith{@link#fillIn}toallowthecurrentdataortypevalue*overwritten,evenifitisalreadyset.*/publicstaticfinalintFILL_IN_DATA=1<<1;/***Usewith{@link#fillIn}toallowthecurrentcategoriestobe*overwritten,eveniftheyarealreadyset.*/publicstaticfinalintFILL_IN_CATEGORIES=1<<2;/***Usewith{@link#fillIn}toallowthecurrentcomponentvaluetobe*overwritten,evenifitisalreadyset.*/publicstaticfinalintFILL_IN_COMPONENT=1<<3;/***Usewith{@link#fillIn}toallowthecurrentpackagevaluetobe*overwritten,evenifitisalreadyset.*/publicstaticfinalintFILL_IN_PACKAGE=1<<4;/***Usewith{@link#fillIn}toallowthecurrentboundsrectangletobe*overwritten,evenifitisalreadyset.*/publicstaticfinalintFILL_IN_SOURCE_BOUNDS=1<<5;/***Usewith{@link#fillIn}toallowthecurrentselectortobe*overwritten,evenifitisalreadyset.*/publicstaticfinalintFILL_IN_SELECTOR=1<<6;/***Usewith{@link#fillIn}toallowthecurrentClipDatatobe*overwritten,evenifitisalreadyset.*/publicstaticfinalintFILL_IN_CLIP_DATA=1<<7;/***Copythecontentsofotherintothisobject,butonly*wherefieldsarenotdefinedbythisobject.Forpurposesofafield*beingdefined,thefollowingpiecesofdataintheIntentare*consideredtobeseparatefields:**

    *
  • action,assetby{@link#setAction}.*
  • dataUriandMIMEtype,assetby{@link#setData(Uri)},*{@link#setType(String)},or{@link#setDataAndType(Uri,String)}.*
  • categories,assetby{@link#addCategory}.*
  • package,assetby{@link#setPackage}.*
  • component,assetby{@link#setComponent(ComponentName)}or*relatedmethods.*
  • sourcebounds,assetby{@link#setSourceBounds}.*
  • selector,assetby{@link#setSelector(Intent)}.*
  • clipdata,assetby{@link#setClipData(ClipData)}.*
  • eachtop-levelnameintheassociatedextras.*
**

Inaddition,youcanusethe{@link#FILL_IN_ACTION},*{@link#FILL_IN_DATA},{@link#FILL_IN_CATEGORIES},{@link#FILL_IN_PACKAGE},*{@link#FILL_IN_COMPONENT},{@link#FILL_IN_SOURCE_BOUNDS},*{@link#FILL_IN_SELECTOR},and{@link#FILL_IN_CLIP_DATA}tooverride*therestrictionwherethecorrespondingfieldwillnotbereplacedif*itisalreadyset.**

Note:Thecomponentfieldwillonlybecopiedif{@link#FILL_IN_COMPONENT}*isexplicitlyspecified.Theselectorwillonlybecopiedif*{@link#FILL_IN_SELECTOR}isexplicitlyspecified.**

Forexample,considerIntentAwith{data="foo",categories="bar"}*andIntentBwith{action="gotit",data-type="some/thing",*categories="one","two"}.**

CallingA.fillIn(B,Intent.FILL_IN_DATA)willresultinAnow*containing:{action="gotit",data-type="some/thing",*categories="bar"}.**@paramotherAnotherIntentwhosevaluesaretobeusedtofillin*thecurrentone.*@paramflagsOptionstocontrolwhichfieldscanbefilledin.**@returnReturnsabitmaskof{@link#FILL_IN_ACTION},*{@link#FILL_IN_DATA},{@link#FILL_IN_CATEGORIES},{@link#FILL_IN_PACKAGE},*{@link#FILL_IN_COMPONENT},{@link#FILL_IN_SOURCE_BOUNDS},and*{@link#FILL_IN_SELECTOR}indicatingwhichfieldswerechanged.*/publicintfillIn(Intentother,intflags){intchanges=0;if(other.mAction!=null&&(mAction==null||(flags&FILL_IN_ACTION)!=0)){mAction=other.mAction;changes|=FILL_IN_ACTION;}if((other.mData!=null||other.mType!=null)&&((mData==null&&mType==null)||(flags&FILL_IN_DATA)!=0)){mData=other.mData;mType=other.mType;changes|=FILL_IN_DATA;}if(other.mCategories!=null&&(mCategories==null||(flags&FILL_IN_CATEGORIES)!=0)){if(other.mCategories!=null){mCategories=newHashSet(other.mCategories);}changes|=FILL_IN_CATEGORIES;}if(other.mPackage!=null&&(mPackage==null||(flags&FILL_IN_PACKAGE)!=0)){//OnlydothisifmSelectorisnotset.if(mSelector==null){mPackage=other.mPackage;changes|=FILL_IN_PACKAGE;}}//Selectorisspecial:itcanonlybesetifexplicitlyallowed,//forthesamereasonasthecomponentname.if(other.mSelector!=null&&(flags&FILL_IN_SELECTOR)!=0){if(mPackage==null){mSelector=newIntent(other.mSelector);mPackage=null;changes|=FILL_IN_SELECTOR;}}if(other.mClipData!=null&&(mClipData==null||(flags&FILL_IN_CLIP_DATA)!=0)){mClipData=other.mClipData;changes|=FILL_IN_CLIP_DATA;}//Componentisspecial:itcan-only-besetifexplicitlyallowed,//sinceotherwisethesendercouldforcetheintentsomewherethe//originatordidn'tintend.if(other.mComponent!=null&&(flags&FILL_IN_COMPONENT)!=0){mComponent=other.mComponent;changes|=FILL_IN_COMPONENT;}mFlags|=other.mFlags;if(other.mSourceBounds!=null&&(mSourceBounds==null||(flags&FILL_IN_SOURCE_BOUNDS)!=0)){mSourceBounds=newRect(other.mSourceBounds);changes|=FILL_IN_SOURCE_BOUNDS;}if(mExtras==null){if(other.mExtras!=null){mExtras=newBundle(other.mExtras);}}elseif(other.mExtras!=null){try{Bundlenewb=newBundle(other.mExtras);newb.putAll(mExtras);mExtras=newb;}catch(RuntimeExceptione){//Modifyingtheextrascancauseustounparcelthecontents//ofthebundle,andifwedothisinthesystemprocessthat//mayfail.Wereallyshouldhandlethis(i.e.,theBundle//implshouldn'tbeontopofaplainmap),butfornowjust//ignoreitandkeeptheoriginalcontents.:(Log.w("Intent","Failurefillinginextras",e);}}returnchanges;}/***WrapperclassholdinganIntentandimplementingcomparisonsonitfor*thepurposeoffiltering.Theclassimplementsits*{@link#equalsequals()}and{@link#hashCodehashCode()}methodsas*simplecallsto{@linkIntent#filterEquals(Intent)}filterEquals()}and*{@linkandroid.content.Intent#filterHashCode()}filterHashCode()}*onthewrappedIntent.*/publicstaticfinalclassFilterComparison{privatefinalIntentmIntent;privatefinalintmHashCode;publicFilterComparison(Intentintent){mIntent=intent;mHashCode=intent.filterHashCode();}/***ReturntheIntentthatthisFilterComparisonrepresents.*@returnReturnstheIntentheldbytheFilterComparison.Do*notmodify!*/publicIntentgetIntent(){returnmIntent;}@Overridepublicbooleanequals(Objectobj){if(objinstanceofFilterComparison){Intentother=((FilterComparison)obj).mIntent;returnmIntent.filterEquals(other);}returnfalse;}@OverridepublicinthashCode(){returnmHashCode;}}/***Determineiftwointentsarethesameforthepurposesofintent*resolution(filtering).Thatis,iftheiraction,data,type,*class,andcategoriesarethesame.Thisdoesnotcompare*anyextradataincludedintheintents.**@paramotherTheotherIntenttocompareagainst.**@returnReturnstrueifaction,data,type,class,andcategories*arethesame.*/publicbooleanfilterEquals(Intentother){if(other==null){returnfalse;}if(mAction!=other.mAction){if(mAction!=null){if(!mAction.equals(other.mAction)){returnfalse;}}else{if(!other.mAction.equals(mAction)){returnfalse;}}}if(mData!=other.mData){if(mData!=null){if(!mData.equals(other.mData)){returnfalse;}}else{if(!other.mData.equals(mData)){returnfalse;}}}if(mType!=other.mType){if(mType!=null){if(!mType.equals(other.mType)){returnfalse;}}else{if(!other.mType.equals(mType)){returnfalse;}}}if(mPackage!=other.mPackage){if(mPackage!=null){if(!mPackage.equals(other.mPackage)){returnfalse;}}else{if(!other.mPackage.equals(mPackage)){returnfalse;}}}if(mComponent!=other.mComponent){if(mComponent!=null){if(!mComponent.equals(other.mComponent)){returnfalse;}}else{if(!other.mComponent.equals(mComponent)){returnfalse;}}}if(mCategories!=other.mCategories){if(mCategories!=null){if(!mCategories.equals(other.mCategories)){returnfalse;}}else{if(!other.mCategories.equals(mCategories)){returnfalse;}}}returntrue;}/***GeneratehashcodethatmatchessemanticsoffilterEquals().**@returnReturnsthehashvalueoftheaction,data,type,class,and*categories.**@see#filterEquals*/publicintfilterHashCode(){intcode=0;if(mAction!=null){code+=mAction.hashCode();}if(mData!=null){code+=mData.hashCode();}if(mType!=null){code+=mType.hashCode();}if(mPackage!=null){code+=mPackage.hashCode();}if(mComponent!=null){code+=mComponent.hashCode();}if(mCategories!=null){code+=mCategories.hashCode();}returncode;}@OverridepublicStringtoString(){StringBuilderb=newStringBuilder(128);b.append("Intent{");toShortString(b,true,true,true,false);b.append("}");returnb.toString();}/**@hide*/publicStringtoInsecureString(){StringBuilderb=newStringBuilder(128);b.append("Intent{");toShortString(b,false,true,true,false);b.append("}");returnb.toString();}/**@hide*/publicStringtoInsecureStringWithClip(){StringBuilderb=newStringBuilder(128);b.append("Intent{");toShortString(b,false,true,true,true);b.append("}");returnb.toString();}/**@hide*/publicStringtoShortString(booleansecure,booleancomp,booleanextras,booleanclip){StringBuilderb=newStringBuilder(128);toShortString(b,secure,comp,extras,clip);returnb.toString();}/**@hide*/publicvoidtoShortString(StringBuilderb,booleansecure,booleancomp,booleanextras,booleanclip){booleanfirst=true;if(mAction!=null){b.append("act=").append(mAction);first=false;}if(mCategories!=null){if(!first){b.append('');}first=false;b.append("cat=[");Iteratori=mCategories.iterator();booleandidone=false;while(i.hasNext()){if(didone)b.append(",");didone=true;b.append(i.next());}b.append("]");}if(mData!=null){if(!first){b.append('');}first=false;b.append("dat=");if(secure){b.append(mData.toSafeString());}else{b.append(mData);}}if(mType!=null){if(!first){b.append('');}first=false;b.append("typ=").append(mType);}if(mFlags!=0){if(!first){b.append('');}first=false;b.append("flg=0x").append(Integer.toHexString(mFlags));}if(mPackage!=null){if(!first){b.append('');}first=false;b.append("pkg=").append(mPackage);}if(comp&&mComponent!=null){if(!first){b.append('');}first=false;b.append("cmp=").append(mComponent.flattenToShortString());}if(mSourceBounds!=null){if(!first){b.append('');}first=false;b.append("bnds=").append(mSourceBounds.toShortString());}if(mClipData!=null){if(!first){b.append('');}first=false;if(clip){b.append("clip={");mClipData.toShortString(b);b.append('}');}else{b.append("(hasclip)");}}if(extras&&mExtras!=null){if(!first){b.append('');}first=false;b.append("(hasextras)");}if(mSelector!=null){b.append("sel={");mSelector.toShortString(b,secure,comp,extras,clip);b.append("}");}}/***Call{@link#toUri}with0flags.*@deprecatedUse{@link#toUri}instead.*/@DeprecatedpublicStringtoURI(){returntoUri(0);}/***ConvertthisIntentintoaStringholdingaURIrepresentationofit.*ThereturnedURIstringhasbeenproperlyURIencoded,soitcanbe*usedwith{@linkUri#parseUri.parse(String)}.TheURIcontainsthe*Intent'sdataasthebaseURI,withanadditionalfragmentdescribing*theaction,categories,type,flags,package,component,andextras.**

YoucanconvertthereturnedstringbacktoanIntentwith*{@link#getIntent}.**@paramflagsAdditionaloperatingflags.Either0or*{@link#URI_INTENT_SCHEME}.**@returnReturnsaURIencodingURIstringdescribingtheentirecontents*oftheIntent.*/publicStringtoUri(intflags){StringBuilderuri=newStringBuilder(128);Stringscheme=null;if(mData!=null){Stringdata=mData.toString();if((flags&URI_INTENT_SCHEME)!=0){finalintN=data.length();for(inti=0;i='a'&&c<='z')||(c>='A'&&c<='Z')||c=='.'||c=='-'){continue;}if(c==':'&&i>0){//Validscheme.scheme=data.substring(0,i);uri.append("intent:");data=data.substring(i+1);break;}//Noscheme.break;}}uri.append(data);}elseif((flags&URI_INTENT_SCHEME)!=0){uri.append("intent:");}uri.append("#Intent;");toUriInner(uri,scheme,flags);if(mSelector!=null){uri.append("SEL;");//Notethatfornowwearenotgoingtotrytohandlethe//datapart;notclearhowtorepresentthisasaURI,and//notmuchutilityinit.mSelector.toUriInner(uri,null,flags);}uri.append("end");returnuri.toString();}privatevoidtoUriInner(StringBuilderuri,Stringscheme,intflags){if(scheme!=null){uri.append("scheme=").append(scheme).append(';');}if(mAction!=null){uri.append("action=").append(Uri.encode(mAction)).append(';');}if(mCategories!=null){for(Stringcategory:mCategories){uri.append("category=").append(Uri.encode(category)).append(';');}}if(mType!=null){uri.append("type=").append(Uri.encode(mType,"/")).append(';');}if(mFlags!=0){uri.append("launchFlags=0x").append(Integer.toHexString(mFlags)).append(';');}if(mPackage!=null){uri.append("package=").append(Uri.encode(mPackage)).append(';');}if(mComponent!=null){uri.append("component=").append(Uri.encode(mComponent.flattenToShortString(),"/")).append(';');}if(mSourceBounds!=null){uri.append("sourceBounds=").append(Uri.encode(mSourceBounds.flattenToString())).append(';');}if(mExtras!=null){for(Stringkey:mExtras.keySet()){finalObjectvalue=mExtras.get(key);charentryType=valueinstanceofString?'S':valueinstanceofBoolean?'B':valueinstanceofByte?'b':valueinstanceofCharacter?'c':valueinstanceofDouble?'d':valueinstanceofFloat?'f':valueinstanceofInteger?'i':valueinstanceofLong?'l':valueinstanceofShort?'s':'\0';if(entryType!='\0'){uri.append(entryType);uri.append('.');uri.append(Uri.encode(key));uri.append('=');uri.append(Uri.encode(value.toString()));uri.append(';');}}}}publicintdescribeContents(){return(mExtras!=null)?mExtras.describeContents():0;}publicvoidwriteToParcel(Parcelout,intflags){out.writeString(mAction);Uri.writeToParcel(out,mData);out.writeString(mType);out.writeInt(mFlags);out.writeString(mPackage);ComponentName.writeToParcel(mComponent,out);if(mSourceBounds!=null){out.writeInt(1);mSourceBounds.writeToParcel(out,flags);}else{out.writeInt(0);}if(mCategories!=null){out.writeInt(mCategories.size());for(Stringcategory:mCategories){out.writeString(category);}}else{out.writeInt(0);}if(mSelector!=null){out.writeInt(1);mSelector.writeToParcel(out,flags);}else{out.writeInt(0);}if(mClipData!=null){out.writeInt(1);mClipData.writeToParcel(out,flags);}else{out.writeInt(0);}out.writeBundle(mExtras);}publicstaticfinalParcelable.CreatorCREATOR=newParcelable.Creator(){publicIntentcreateFromParcel(Parcelin){returnnewIntent(in);}publicIntent[]newArray(intsize){returnnewIntent[size];}};/**@hide*/protectedIntent(Parcelin){readFromParcel(in);}publicvoidreadFromParcel(Parcelin){setAction(in.readString());mData=Uri.CREATOR.createFromParcel(in);mType=in.readString();mFlags=in.readInt();mPackage=in.readString();mComponent=ComponentName.readFromParcel(in);if(in.readInt()!=0){mSourceBounds=Rect.CREATOR.createFromParcel(in);}intN=in.readInt();if(N>0){mCategories=newHashSet();inti;for(i=0;itagstoaddcategoriesand*toattachextradata*totheintent.**@paramresourcesTheResourcestousewheninflatingresources.*@paramparserTheXMLparserpointingatan"intent"tag.*@paramattrsTheAttributeSetinterfaceforretrievingextended*attributedataatthecurrentparserlocation.*@returnAnIntentobjectmatchingtheXMLdata.*@throwsXmlPullParserExceptionIftherewasanXMLparsingerror.*@throwsIOExceptionIftherewasanI/Oerror.*/publicstaticIntentparseIntent(Resourcesresources,XmlPullParserparser,AttributeSetattrs)throwsXmlPullParserException,IOException{Intentintent=newIntent();TypedArraysa=resources.obtainAttributes(attrs,com.android.internal.R.styleable.Intent);intent.setAction(sa.getString(com.android.internal.R.styleable.Intent_action));Stringdata=sa.getString(com.android.internal.R.styleable.Intent_data);StringmimeType=sa.getString(com.android.internal.R.styleable.Intent_mimeType);intent.setDataAndType(data!=null?Uri.parse(data):null,mimeType);StringpackageName=sa.getString(com.android.internal.R.styleable.Intent_targetPackage);StringclassName=sa.getString(com.android.internal.R.styleable.Intent_targetClass);if(packageName!=null&&className!=null){intent.setComponent(newComponentName(packageName,className));}sa.recycle();intouterDepth=parser.getDepth();inttype;while((type=parser.next())!=XmlPullParser.END_DOCUMENT&&(type!=XmlPullParser.END_TAG||parser.getDepth()>outerDepth)){if(type==XmlPullParser.END_TAG||type==XmlPullParser.TEXT){continue;}StringnodeName=parser.getName();if(nodeName.equals("category")){sa=resources.obtainAttributes(attrs,com.android.internal.R.styleable.IntentCategory);Stringcat=sa.getString(com.android.internal.R.styleable.IntentCategory_name);sa.recycle();if(cat!=null){intent.addCategory(cat);}XmlUtils.skipCurrentTag(parser);}elseif(nodeName.equals("extra")){if(intent.mExtras==null){intent.mExtras=newBundle();}resources.parseBundleExtra("extra",attrs,intent.mExtras);XmlUtils.skipCurrentTag(parser);}else{XmlUtils.skipCurrentTag(parser);}}returnintent;}/***NormalizeaMIMEdatatype.**

AnormalizedMIMEtypehaswhite-spacetrimmed,*content-typeparametersremoved,andislower-case.*ThisalignsthetypewithAndroidbestpracticesfor*intentfiltering.**

Forexample,"text/plain;charset=utf-8"becomes"text/plain".*"text/x-vCard"becomes"text/x-vcard".**

AllMIMEtypesreceivedfromoutsideAndroid(suchasuserinput,*orexternalsourceslikeBluetooth,NFC,ortheInternet)should*benormalizedbeforetheyareusedtocreateanIntent.**@paramtypeMIMEdatatypetonormalize*@returnnormalizedMIMEdatatype,ornulliftheinputwasnull*@see{@link#setType}*@see{@link#setTypeAndNormalize}*/publicstaticStringnormalizeMimeType(Stringtype){if(type==null){returnnull;}type=type.trim().toLowerCase(Locale.US);finalintsemicolonIndex=type.indexOf(';');if(semicolonIndex!=-1){type=type.substring(0,semicolonIndex);}returntype;}/***Migrateany{@link#EXTRA_STREAM}in{@link#ACTION_SEND}and*{@link#ACTION_SEND_MULTIPLE}to{@linkClipData}.**@hide*/publicvoidmigrateExtraStreamToClipData(){//Refusetotouchifextrasalreadyparcelledif(mExtras!=null&&mExtras.isParcelled())return;//BailwhensomeonealreadygaveusClipDataif(getClipData()!=null)return;finalStringaction=getAction();if(ACTION_SEND.equals(action)){finalUristream=getParcelableExtra(EXTRA_STREAM);if(stream!=null){finalClipDataclipData=newClipData(null,newString[]{getType()},newClipData.Item(stream));setClipData(clipData);addFlags(FLAG_GRANT_READ_URI_PERMISSION);}}elseif(ACTION_SEND_MULTIPLE.equals(action)){finalArrayListstreams=getParcelableArrayListExtra(EXTRA_STREAM);if(streams!=null&&streams.size()>0){finalUrifirstStream=streams.get(0);finalClipDataclipData=newClipData(null,newString[]{getType()},newClipData.Item(firstStream));finalintsize=streams.size();for(inti=1;i



請為這篇文章評分?