我有这个java代码:
final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
final List<ResolveInfo> pkgAppsList = this.getPackageManager().queryIntentActivities( mainIntent, 0);
ArrayList<String> mIdList=new ArrayList<String>();
for(ResolveInfo mtemp:pkgAppsList){
mIdList.add(mtemp.activityInfo.applicationInfo.packageName);
}
Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage(mIdList.get(2));
startActivity( LaunchIntent )
我试图在delphi中使用它,但我不知道如何使用Jlist(在delphi中)而不是List < ResolveInfo >(java),因为函数“queryIntentActivities”的结果是一个JList。
var pm:JPackageManager;
intent:JIntent;
list:jlist;
rinfo:JResolveInfo;
begin
pm:=SharedActivityContext.getPackageManager;
intent:=TJIntent.JavaClass.getIntent(TJIntent.JavaClass.ACTION_MAIN);
intent:= intent.addCategory(TJIntent.JavaClass.CATEGORY_LAUNCHER);
list:=pm.queryIntentActivities(intent,TJPackageManager.JavaClass.PERMISSION_GRANTED);
ShowMessage(IntToStr(list.size));
end;
我如何在delphi中使用与Jresolverinfo关联的Jlist?因为在 java 中是这样声明的:List < ResolveInfo > or how I can convert this for(ResolveInfo mtemp:pkgAppsList)
in delphi
更新:也the size of the list
总是 0 但这是不可能的。可能是什么问题?