Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.Iterator; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; public class Main { public static ArrayList<String> getHaveIntent(Intent intent, PackageManager pm) { ArrayList<String> ret = new ArrayList<String>(); Iterator<ResolveInfo> obj = pm.queryIntentActivities(intent, 0).iterator(); if (obj != null) { while (obj.hasNext()) { ResolveInfo resolveinfo = (ResolveInfo) obj.next(); if (resolveinfo.activityInfo.packageName != null) { String packName = resolveinfo.activityInfo.packageName; ret.add(packName); } } } return ret; } }