Code example for Intent

Methods: setTypequeryIntentActivities

0
     * @param mimeType 
     *            the MIME type of the content (may be null) 
     * @return true if there are apps which will respond to this action/type 
     */ 
    public static boolean isIntentAvailable(Context context, String action, String mimeType) {
        final Intent intent = new Intent(action);
        if (mimeType != null) {
            intent.setType(mimeType);
        } 
        List<ResolveInfo> list = context.getPackageManager().queryIntentActivities(intent,
                PackageManager.MATCH_DEFAULT_ONLY);
        return !list.isEmpty();
    } 
 
    /** 
     * Checks whether there are applications installed which are able to handle the given intent. 
     *  
     * @param context 
     *            the current context 
     * @param intent 
     *            the intent to check