public void getAppSize(ArrayList<ApplicationInfo> data) {
for (int m = 0; m < data.size(); m++) {
packageManager = getPackageManager();
Method getPackageSizeInfo;
try {
getPackageSizeInfo = packageManager.getClass().getMethod("getPackageSizeInfo", String.class, IPackagestatsObserver.class);
if (getPackageSizeInfo != null) {
try {
getPackageSizeInfo.invoke(packageManager, data.get(m).packageName, new cachePackState());
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
}
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
}
}