Android Intent 5.1

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.