Java Code Examples for android.content.pm.PackageManager.queryIntentActivityOptions()

The following are Jave code examples for showing how to use queryIntentActivityOptions() of the android.content.pm.PackageManager class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: boohee_v5.6   File: MenuBuilder.java   View Source Code Vote up 6 votes
public int addIntentOptions(int group, int id, int categoryOrder, ComponentName caller, Intent[] specifics, Intent intent, int flags, MenuItem[] outSpecificItems) {
    PackageManager pm = this.mContext.getPackageManager();
    List<ResolveInfo> lri = pm.queryIntentActivityOptions(caller, specifics, intent, 0);
    int N = lri != null ? lri.size() : 0;
    if ((flags & 1) == 0) {
        removeGroup(group);
    }
    for (int i = 0; i < N; i++) {
        Intent intent2;
        ResolveInfo ri = (ResolveInfo) lri.get(i);
        if (ri.specificIndex < 0) {
            intent2 = intent;
        } else {
            intent2 = specifics[ri.specificIndex];
        }
        Intent rintent = new Intent(intent2);
        rintent.setComponent(new ComponentName(ri.activityInfo.applicationInfo.packageName, ri.activityInfo.name));
        MenuItem item = add(group, id, categoryOrder, ri.loadLabel(pm)).setIcon(ri.loadIcon(pm)).setIntent(rintent);
        if (outSpecificItems != null && ri.specificIndex >= 0) {
            outSpecificItems[ri.specificIndex] = item;
        }
    }
    return N;
}
 
Example 2
Project: CSipSimple   File: ActionMenu.java   View Source Code Vote up 5 votes
public int addIntentOptions(int groupId, int itemId, int order,
        ComponentName caller, Intent[] specifics, Intent intent, int flags,
        MenuItem[] outSpecificItems) {
    PackageManager pm = mContext.getPackageManager();
    final List<ResolveInfo> lri =
            pm.queryIntentActivityOptions(caller, specifics, intent, 0);
    final int N = lri != null ? lri.size() : 0;

    if ((flags & FLAG_APPEND_TO_GROUP) == 0) {
        removeGroup(groupId);
    }

    for (int i=0; i<N; i++) {
        final ResolveInfo ri = lri.get(i);
        Intent rintent = new Intent(
            ri.specificIndex < 0 ? intent : specifics[ri.specificIndex]);
        rintent.setComponent(new ComponentName(
                ri.activityInfo.applicationInfo.packageName,
                ri.activityInfo.name));
        final MenuItem item = add(groupId, itemId, order, ri.loadLabel(pm))
                .setIcon(ri.loadIcon(pm))
                .setIntent(rintent);
        if (outSpecificItems != null && ri.specificIndex >= 0) {
            outSpecificItems[ri.specificIndex] = item;
        }
    }

    return N;
}
 
Example 3
Project: CSipSimple   File: MenuBuilder.java   View Source Code Vote up 5 votes
public int addIntentOptions(int group, int id, int categoryOrder, ComponentName caller,
        Intent[] specifics, Intent intent, int flags, MenuItem[] outSpecificItems) {
    PackageManager pm = mContext.getPackageManager();
    final List<ResolveInfo> lri =
            pm.queryIntentActivityOptions(caller, specifics, intent, 0);
    final int N = lri != null ? lri.size() : 0;

    if ((flags & FLAG_APPEND_TO_GROUP) == 0) {
        removeGroup(group);
    }

    for (int i=0; i<N; i++) {
        final ResolveInfo ri = lri.get(i);
        Intent rintent = new Intent(
            ri.specificIndex < 0 ? intent : specifics[ri.specificIndex]);
        rintent.setComponent(new ComponentName(
                ri.activityInfo.applicationInfo.packageName,
                ri.activityInfo.name));
        final MenuItem item = add(group, id, categoryOrder, ri.loadLabel(pm))
                .setIcon(ri.loadIcon(pm))
                .setIntent(rintent);
        if (outSpecificItems != null && ri.specificIndex >= 0) {
            outSpecificItems[ri.specificIndex] = item;
        }
    }

    return N;
}