一、PackageManager的resolveActivity 返回能夠匹配的Intent,如果不能匹配就返回NULL, 二、PackageManager的queryIntentActivities 返回所有成功匹配的Activity信息 三、Intent的resolveActivity 第一個參 ...
一、PackageManager的resolveActivity
public abstract ResolveInfo resolveActivity(Intent intent, int flags);
getPackageManager().resolveActivity();
返回能夠匹配的Intent,如果不能匹配就返回NULL,
二、PackageManager的queryIntentActivities
public abstract List<ResolveInfo> queryIntentActivities(Intent intent, int flags);
getPackageManager().queryIntentActivities(intent,PackageManager.MATCH_DEFAULT_ONLY);
返回所有成功匹配的Activity信息
三、Intent的resolveActivity
public ComponentName resolveActivity(PackageManager pm)
Intent intent = new Intent(); ComponentName componentName = intent.resolveActivity();
第一個參數代表Intent
第二個參數:設置PackageManager.MATCH_DEFAULT_ONLY