目前,我正在检索图标的应用名称,其中包含以下应用:
final PackageManager pm = context.getPackageManager();
ApplicationInfo ai;
for (int i = 0; i < data.size(); i++)
{
try
{
ai = pm.getApplicationInfo(data.get(i).packageName, 0);
}
catch (final PackageManager.NameNotFoundException e)
{
ai = null;
}
data.get(i).label = (String) (ai != null ? pm.getApplicationLabel(ai) : data.get(i).packageName);
}
这可以改善吗?它很慢,我想知道是否有任何方法可以进行批量查询,而不是100次单个查询...