is Intent Safe - Android android.content

Android examples for android.content:Intent

Description

is Intent Safe

Demo Code

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import java.util.List;

public class Main{

    public static boolean isIntentSafe(Context context, Uri uri) {
        Intent mapCall = new Intent(Intent.ACTION_VIEW, uri);
        PackageManager packageManager = context.getPackageManager();
        List<ResolveInfo> activities = packageManager
                .queryIntentActivities(mapCall, 0);
        return activities.size() > 0;
    }/*from   w  ww.  j  a  v  a2  s  .co  m*/

}

Related Tutorials