1.intent 6 Items
Action, data (URI &type), Component name,extras,flags
2.data---URI & type
No matter what parameters are used, action,type or otherwise, the key question is.
All new activity starts and eventually requires component name.
So, intent can be analyzed to get component name, it can be used.
Private voidSendbroadcast (LongEventId,LongBeginLongend, String title) {Uri.builder Builder=CalendarContract.CONTENT_URI.buildUpon (); Builder.appendencodedpath ("events/" +eventId); Uri URI=Builder.build (); Intent I=NewIntent (event_detail_action); I.putextra (Extra_event_begin_time, BEGIN); I.putextra (Extra_event_end_time, END); I.putextra (title, title);//I.setdataandtype (URI, extra_type);I.setdata (URI); if(I.resolveactivity (Getpackagemanager ())! =NULL) {startactivity (i); } }
About the issue of data transfer. In general, the URI and type only need one.
The point is that each of our activtiy is best to specify the type of processing when we need to do implicit intent delivery.
<activity android:name= ". Agenda. Agendadetailactivity "> <intent-filter> <action android:name=" Com.xui.calendar.agenda_detail "></action> <category android:name=" Android.intent.category.DEFAULT "/> <data android: Mimetype= "Vnd.android.cursor.item/event"/> </intent-filter> <intent-filter> < Action android:name= "Android.intent.action.VIEW"/> <category android:name= " Android.intent.category.DEFAULT "/> <data android:mimetype=" Vnd.android.cursor.item/event "/> </intent-filter> </activity>
But we might just want the legendary URI to be used by activtiy, and at this point the URI with the content type is guaranteed to be unique.
Because each URI corresponds to a database, and the database is of a type. Content_item_type.
In turn, AMS can be matched by the type of database.
So you can just pass the URI case.
If you want to pass the URI & type at the same time. Setdataandtype.
Android Intent 5.1