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 7647297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:25:40+00:00 2026-05-31T10:25:40+00:00

I’m trying to allow the user to choose which app to open when they

  • 0

I’m trying to allow the user to choose which app to open when they press on my widget. It seems the way to do this is to use the ACTION_PICK_ACTIVITY and somehow save the value they’ve picked.

http://www.openintents.org/en/node/263 seems helpful, but does not show how to extract the data from the Intent in able to save it for future Intent creation.

How can I easily allow the user to pick from a list of applications installed on his or her phone and then save the chosen package/class for future intent creation?

View.OnClickListener activity_picker_listener = new View.OnClickListener(){
    @Override
    public void onClick(View v){
        // Pick an application
        Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
        mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);

        Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY);
        pickIntent.putExtra(Intent.EXTRA_INTENT, mainIntent);
        startActivityForResult(pickIntent, 0);
    }
};

// The result is obtained in onActivityResult:
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (data != null) {
       // save the application that we just picked
   }
}
  • 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-05-31T10:25:42+00:00Added an answer on May 31, 2026 at 10:25 am

    You could save the package name of the chosen application in your application (sdCard, cache, etc). Then, when the user clicks on your widget and calls the click listener, you do this:

    PackageManager packageManager = this.getPackageManager();
    Intent launchIntent = packageManager.getLaunchIntentForPackage(packageName);
    launchIntent.addCategory(Intent.CATEGORY_LAUNCHER);
    launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(launchIntent);
    

    UPDATE:

    This will get all the installed applications on the user’s phone:

    Intent intent = new Intent(Intent.ACTION_MAIN, null);
    intent.addCategory(Intent.CATEGORY_LAUNCHER);
    List<ResolveInfo> applications = getPackageManager().queryIntentActivities(intent, 0);
    

    The ResolveInfo class contains a lot of useful information about the application, including its package name. Once the user chooses an application, you get the package name from its ResolveInfo object and use the other code to open the progam.

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I am using Paperclip to handle profile photo uploads in my app. They upload
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,

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.