Android.intent.category.DEFAULT

Source: Internet
Author: User

When do we need to add Android.intent.category.DEFAULT?

1, to understand this problem, first need to figure out what is implicit (implicit) intent what is explicit (show) intent.

Explicit Intent explicitly specifies the acitivity to start, such as the following Java code:
Intent intent= New Intent (this, b.class)

Implicit intent does not explicitly specify which activity to start, but instead sets some intent filter to allow the system to filter the appropriate acitivity to start.

2, intent exactly to which activity, need to do three matches, one is action, one is category, one is data.

Theoretically, if intent does not specify category, then whatever the contents of the intent filter should be matched. However, if it is implicit intent,android default to add a category_default, so if intent If the category is not Android.intent.category.DEFAULT in filter, the match test will fail. So, if your activity supports receiving implicit intent, be sure to include Android.intent.category.DEFAULT in intent filter.

Exceptions are: Android.intent.category.MAIN and Android.intent.category.LAUNCHER do not need to join the Android.intent.category.DEFAULT in the filter, of course, not to ask Problem.

We define the activity if accept implicit intent words, intent filer must add android.intent.category.DEFAULT this category.

My problem is to be here. Forget to add <category android:name= "Android.intent.category.DEFAULT"/> This in Intent-filter.

Transferred from: http://www.cnblogs.com/roemin/archive/2011/08/11/2134442.html

Android.intent.category.DEFAULT

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.