In my android application i am calling the following function many times inside a loop for getting label/name of the application :
public String getName(int uid){
String packageName=packageManager.getNameForUid(uid);
ApplicationInfo ai;
try {
ai = packageManager.getApplicationInfo( packageName, 0);
} catch (final PackageManager.NameNotFoundException e) {
System.out.println(uid);
ai = null;
}
return (String) (ai != null ? packageManager.getApplicationLabel(ai) : "(unknown)");
}
And for the first onClick() it produces warnings like following in Logcat:
2020-04-15 18:45:25.219 22291-22340/com.dhruv.test W/ResourceType: ResTable_typeSpec entry count inconsistent: given 32, previously 38
2020-04-15 18:45:25.220 22291-22340/com.dhruv.test W/ResourceType: ResTable_typeSpec entry count inconsistent: given 2167, previously 2164
2020-04-15 18:45:25.220 22291-22340/com.dhruv.test W/ResourceType: ResTable_typeSpec entry count inconsistent: given 268, previously 1515
but on consecutive clicks it does not occur. Due to these warnings the execution time of loop becomes ~600ms else it takes ~200ms only to iterate.