Java tutorial
//package com.java2s; 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 { /** * This method queries the system to check if there is a viewer available or not. If no suitable viewer is * found, this method returns false. * @return True if PDF viewer is available, false otherwise. */ public static boolean isViewerAvailable(Context context, Uri uri) { final PackageManager packageManager = context.getPackageManager(); final Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(uri); final List<ResolveInfo> list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); return list.size() > 0; } }