當前位置: 首頁>>代碼示例>>Java>>正文


Java PackageManager.queryIntentActivityOptions方法代碼示例

本文整理匯總了Java中android.content.pm.PackageManager.queryIntentActivityOptions方法的典型用法代碼示例。如果您正苦於以下問題:Java PackageManager.queryIntentActivityOptions方法的具體用法?Java PackageManager.queryIntentActivityOptions怎麽用?Java PackageManager.queryIntentActivityOptions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.content.pm.PackageManager的用法示例。


在下文中一共展示了PackageManager.queryIntentActivityOptions方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addIntentOptions

import android.content.pm.PackageManager; //導入方法依賴的package包/類
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;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:25,代碼來源:MenuBuilder.java

示例2: addIntentOptions

import android.content.pm.PackageManager; //導入方法依賴的package包/類
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;
}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:30,代碼來源:ActionMenu.java

示例3: addIntentOptions

import android.content.pm.PackageManager; //導入方法依賴的package包/類
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;
}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:29,代碼來源:MenuBuilder.java


注:本文中的android.content.pm.PackageManager.queryIntentActivityOptions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。