Android------Intent.createchooser

Source: Internet
Author: User

There are three steps in the intent matching process, including Action , category and data matching. If more than one result is matched, the system displays a dialog for the user to select. Such as:

So today we are mainly to explain, How to customize the title of this chooser?

The code is actually simple, as follows:

  
  1. intent Intent = new intent ( intent action_get_content
  2. Intent . SetType ("audio/*");
  3. startactivity (Intent. Createchooser (Intent, "Select Music");

Maybe a lot of students will wonder in the Createchooser () method,what does Android do?

Let's take a look at the source code for this method:

  
  1. public static Span class= "PLN" > intent Createchooser ( intent target charsequence Title ) {
  2. intent Intent = new intent ( action_chooser
  3. Intent . PutExtra (extra_intent, target);
  4. if (title = null ) {
  5. Intent . PutExtra (extra_title, TITLE);
  6. }
  7. return Intent ;
  8. }

It should be clear to everyone, originally in the Call Createchooser () method, the system has created a new ACTION for the action_chooser Intent, and our original intent as a parameter passed in. The TITLE of the selector is passed in through extra_title .

Android------Intent.createchooser

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.