title: How to get installed applications in Android and no system apps?
body: <p>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). </p>
  
  <p>My current code is: </p>
  
  <pre><code>    final PackageManager pm = getActivity().getPackageManager();
      List&lt;PackageInfo&gt; apps = pm.getInstalledPackages(PackageManager.GET_META_DATA);
  
      ArrayList&lt;PackageInfo&gt; aux = new ArrayList&lt;PackageInfo&gt;();
  
      for (int i = 0; i &lt; apps.size(); i++) {
          if (apps.get(i).versionName != null &amp;&amp; ((apps.get(i).applicationInfo.flags &amp; ApplicationInfo.FLAG_SYSTEM) != 1)) {
              aux.add(apps.get(i)); 
          }
  </code></pre>
  
  <p>With this code, I can get the user installed apps, and if I comment the 'if' instruction, I will get the system apps. </p>
  
  <p>So, I want to get the user installed apps and apps like contacts, gallery and so on.</p>
  
  <p>UPDATE:</p>
  
  <pre><code>    final PackageManager pm = getActivity().getPackageManager();
      Intent intent = new Intent(Intent.ACTION_MAIN, null);
      intent.addCategory(Intent.CATEGORY_LAUNCHER);
      List&lt;ResolveInfo&gt; apps = pm.queryIntentActivities(intent, PackageManager.GET_META_DATA);
  </code></pre>