本文整理汇总了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;
}
示例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;
}
示例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;
}