How do i use this method in a list to filter out the system package from a list?
I currently have this method up:
public static List<ApplicationInfo> getInstalledApplication(Context context) {
PackageManager packageManager = context.getPackageManager();
List<ApplicationInfo> apps = packageManager.getInstalledApplications(0);
Collections.sort(apps, new ApplicationInfo.DisplayNameComparator(packageManager));
return apps;
}
Method to filter out system package:
private boolean isSystemPackage(ResolveInfo ri){
return ((ri.activityInfo.applicationInfo.flags&ApplicationInfo.FLAG_SYSTEM)!=0)?true:false;
}
This will filter out system packages: