is Intent Available - Android Intent

Android examples for Intent:Open App

Description

is Intent Available

Demo Code


//package com.java2s;

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 boolean isIntentAvailable(Context context, String action) {
        final PackageManager packageManager = context.getPackageManager();
        final Intent intent = new Intent(action);
        List<ResolveInfo> list = packageManager.queryIntentActivities(
                intent, PackageManager.MATCH_DEFAULT_ONLY);
        if (list.size() > 0)
            return true;
        return false;
    }//from ww  w .ja v  a 2 s .  c  om
}

Related Tutorials