Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8489541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:51:28+00:00 2026-06-10T21:51:28+00:00

How do I automatically get/pick the first Application, that handles a specified Intent, as

  • 0

How do I automatically get/pick the first Application, that handles a specified Intent, as if the user selected the first option in a createChooser() dialog.

In this example choose between applications that send data like emails:

final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
SendEmailActivity.this.startActivity(Intent.createChooser(1, "Send mail..."));

Please help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T21:51:30+00:00Added an answer on June 10, 2026 at 9:51 pm

    using the answer to this question you can get a list of all the apps with intent android.content.Intent.ACTION_SEND

    here’s a working example I coded below (ends up picking gmail on my device)

    **Fair warning – will throw a NullPointerException if no email accounts have been setup
    you should add a null check on the variable pkgAppsList and tell the user no email applications found or have been setup

        //set the main intent to ACTION_SEND for looking for applications that share information
        Intent intent = new Intent(Intent.ACTION_SEND, null);
    
        //intent.addCategory(Intent.CATEGORY_LAUNCHER); //if you want extra filters
    
        //filter out apps that are able to send plain text
        intent.setType("plain/text");
    
        //get a list of apps that meet your criteria above
        List<ResolveInfo> pkgAppsList = this.getPackageManager().queryIntentActivities( intent, PackageManager.MATCH_DEFAULT_ONLY | PackageManager.GET_RESOLVED_FILTER);
    
        //select the first one in the list
        ResolveInfo info = pkgAppsList.get(0);      
        String packageName = info.activityInfo.packageName;
        String className = info.activityInfo.name;
    
        //set the intent to luanch that specific app
        intent.setClassName(packageName, className);
    
        //some samples on adding more then one email address
        String aEmailList[] = { "user@fakehost.com","user2@fakehost.com" };
        String aEmailCCList[] = { "user3@fakehost.com","user4@fakehost.com"};
        String aEmailBCCList[] = { "user5@fakehost.com" };
    
        //all the extras that will be passed to the email app       
        intent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList);
        intent.putExtra(android.content.Intent.EXTRA_CC, aEmailCCList);
        intent.putExtra(android.content.Intent.EXTRA_BCC, aEmailBCCList);
        intent.putExtra(android.content.Intent.EXTRA_SUBJECT, "My subject");
        intent.putExtra(android.content.Intent.EXTRA_TEXT, "My message body.");
    
        //start the app
        startActivity(intent);
    

    if you want to whitelist what app is being called you can loop through the list checking each package name for a specific package (example: gmail is “com.google.android.gm”)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a sharepoint instance on our network that we get automatically logged into
I have a table that acts as a dropbox for files that get automatically
Seeking means to get Fabric to automatically (instead of user-interactively) interact with shell commands
When the phone rings I get a screen that pops up automatically with two
I have an application that lets users get a *.onemobi.net account (ex. bob.onemobi.net ).
When a user runs my app (iOS or Android), can I automatically get their
If I do the following, does filehandle get closed automatically as it goes out
I am trying to get my app automatically launched when the phone gets connected
I'm trying to get php to automatically pass the session ID via url, even
I'm trying to get my FBML canvas page to automatically prompt new app users

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.