Example usage for android.content Intent ACTION_PICK_ACTIVITY

List of usage examples for android.content Intent ACTION_PICK_ACTIVITY

Introduction

In this page you can find the example usage for android.content Intent ACTION_PICK_ACTIVITY.

Prototype

String ACTION_PICK_ACTIVITY

To view the source code for android.content Intent ACTION_PICK_ACTIVITY.

Click Source Link

Document

Activity Action: Pick an activity given an intent, returning the class selected.

Usage

From source file:org.bohrmeista.chan.ui.activity.BaseActivity.java

/**
 * Let the user choose between all activities that can open the url. This is
 * done to prevent "open in browser" opening the url in our own app.
 *
 * @param url//from  w  w  w .  jav a 2s.  c om
 */
public void showUrlOpenPicker(String url) {
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));

    Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY);
    pickIntent.putExtra(Intent.EXTRA_INTENT, intent);

    startActivityForResult(pickIntent, ACTION_OPEN_URL);
}

From source file:com.android.launcher2.Launcher.java

void processShortcut(Intent intent) {
    // Handle case where user selected "Applications"
    String applicationName = getResources().getString(R.string.group_applications);
    String shortcutName = intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);

    if (applicationName != null && applicationName.equals(shortcutName)) {
        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);
        pickIntent.putExtra(Intent.EXTRA_TITLE, getText(R.string.title_select_application));
        startActivityForResultSafely(pickIntent, REQUEST_PICK_APPLICATION);
    } else {/*from www.  ja va  2  s.  co m*/
        startActivityForResultSafely(intent, REQUEST_CREATE_SHORTCUT);
    }
}

From source file:com.cognizant.trumobi.PersonaLauncher.java

void processShortcut(Intent intent, int requestCodeApplication, int requestCodeShortcut) {

    PersonaLog.e(LOG_TAG, "processShortcut" + intent);
    // Handle case where user selected "Applications"
    String applicationName = getResources().getString(R.string.group_applications);
    String shortcutName = intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);

    if (applicationName != null && applicationName.equals(shortcutName)) {
        Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
        mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);

        // 290778 modified for shortcut
        /*/*  w w w.  j a  v  a 2  s  .  co  m*/
         * Intent mainIntent = new Intent("Email");
         * mainIntent.addCategory("android.intent.category.PIM");
         */

        Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY);
        pickIntent.putExtra(Intent.EXTRA_INTENT, mainIntent);
        pickIntent.putExtra(Intent.EXTRA_TITLE, getString(R.string.group_applications));
        startActivityForResult(pickIntent, requestCodeApplication);
    } else {
        startActivityForResult(intent, requestCodeShortcut);
    }
}

From source file:com.android.soma.Launcher.java

void processShortcut(Intent intent) {
    // Handle case where user selected "Applications"
    String applicationName = getResources().getString(R.string.group_applications);
    String shortcutName = intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);

    if (applicationName != null && applicationName.equals(shortcutName)) {
        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);
        pickIntent.putExtra(Intent.EXTRA_TITLE, getText(R.string.title_select_application));
        Utilities.startActivityForResultSafely(this, pickIntent, REQUEST_PICK_APPLICATION);
    } else {//from w w  w .j  av a2  s .c  o  m
        Utilities.startActivityForResultSafely(this, intent, REQUEST_CREATE_SHORTCUT);
    }
}