get Intent Shared Targets - Android android.content

Android examples for android.content:Intent

Description

get Intent Shared Targets

Demo Code

import java.util.List;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;

public class Main {

  public static List<ResolveInfo> getShareTargets(Context ctx) {
    Intent intent = new Intent(Intent.ACTION_SEND, null);
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.setType("text/plain");
    PackageManager pm = ctx.getPackageManager();
    return pm.queryIntentActivities(intent, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT);
  }//from   w w  w. j  a  va 2 s  . c o  m

}

Related Tutorials