アイコンとアプリケーション名をロードするためのこのコードがありますが、50を超えるアプリケーションでは遅く、ロードに7〜8秒かかります。アプリケーション名とアイコンをより速くロードするにはどうすればよいですか?
private void loadApps() {
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
InternalDataManager.apps = getPackageManager()
.queryIntentActivities(mainIntent, 0);
PackageManager pm = getPackageManager();
for (int i = 0; i < InternalDataManager.apps.size(); i++) {
ResolveInfo info = InternalDataManager.apps.get(i);
// PInfo holds name and icon
PInfo infoP = new InternalDataManager.PInfo();
infoP.appname = info.activityInfo.applicationInfo.loadLabel(pm)
.toString();
infoP.icon = info.activityInfo.loadIcon(pm);
infoP.pname = info.activityInfo.applicationInfo.packageName;
}
}