PackageManager-->resolveActivity查询是否有符合条件的Activity
Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse(url), mimetype); if (getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY) != null) { // someone knows how to handle this mime type with this scheme, don't download. try { startActivity(intent); return; } catch (ActivityNotFoundException ex) { if (Config.LOGD) { Log.d(LOGTAG, "activity not found for " + mimetype + " over " + Uri.parse(url).getScheme(), ex); } }