I want to get all application which appears in the menu screen. But, now I only get the user installed apps or all the application (included the system application).
My current code is:
    final PackageManager pm = getActivity().getPackageManager();
    List<PackageInfo> apps = pm.getInstalledPackages(PackageManager.GET_META_DATA);
    ArrayList<PackageInfo> aux = new ArrayList<PackageInfo>();
    for (int i = 0; i < apps.size(); i++) {
        if (apps.get(i).versionName != null && ((apps.get(i).applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 1)) {
            aux.add(apps.get(i)); 
        }
With this code, I can get the user installed apps, and if I comment the 'if' instruction, I will get the system apps.
So, I want to get the user installed apps and apps like contacts, gallery and so on.
UPDATE:
    final PackageManager pm = getActivity().getPackageManager();
    Intent intent = new Intent(Intent.ACTION_MAIN, null);
    intent.addCategory(Intent.CATEGORY_LAUNCHER);
    List<ResolveInfo> apps = pm.queryIntentActivities(intent, PackageManager.GET_META_DATA);