public boolean isIntentAvailable(Context context, String action) { final PackageManager packageManager = context.getPackageManager(); final Intent intent = new Intent(action); List list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); return list.size() > 0; } ... scanAvailable = isIntentAvailable(this, "com.google.zxing.client.android.SCAN"); ...
沒有留言:
張貼留言