title: How to exclude a specific application from ACTION_SEND Intent?
body: <p>I have used the following codes to exclude facebook app from my app chooser:</p>
  
  <pre><code> List&lt;Intent&gt; targetedShareIntents = new ArrayList&lt;Intent&gt;();
      Intent intent = new Intent(android.content.Intent.ACTION_SEND);
      intent.setType("image/*");
      List&lt;ResolveInfo&gt; resInfo = getActivity().getPackageManager().queryIntentActivities(intent, 0);
      if (!resInfo.isEmpty()) {
          for (ResolveInfo resolveInfo : resInfo) {
              String packageName = resolveInfo.activityInfo.packageName;
              Intent targetedShareIntent = new Intent(android.content.Intent.ACTION_SEND);
              targetedShareIntent.setType("image/*");
              targetedShareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "tooter.nl");
              if (!TextUtils.equals(packageName, "com.facebook.katana")) {
  
  
                  targetedShareIntent.putExtra(android.content.Intent.EXTRA_TEXT, st);
                  targetedShareIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
                  targetedShareIntent.setPackage(packageName);
                  targetedShareIntents.add(targetedShareIntent);
              }
  
          }
          Intent chooserIntent = Intent.createChooser(targetedShareIntents.remove(0), "Select app to share");
          chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, targetedShareIntents.toArray(new Parcelable[targetedShareIntents.size()]));
          startActivity(chooserIntent);
      }
  </code></pre>
  
  <p>Facebook app was removed when I used the code. But the sad part was, even Twitter app was also removed from the app chooser and other unnecessary apps like "Android system" was listed on the chooser . What should i do ? Is something missing or wrong with this code ?</p>