/**
* 从uri中解析出Intent
*
* @param context 上下文
* @param uri uri
* @param flags intentFlags
*
* @return Intent
*/
public static Intent getIntentFromUri(Context context, String uri, int flags) {
try {
Intent intent = Intent.parseUri(uri, flags);
if (intent == null) {
return null;
}
List<ResolveInfo> list = context.getPackageManager().queryIntentActivities(intent, 0);
if (list == null || list.isEmpty()) {
return null;
}
if (!(context instanceof Activity)) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
return intent;
} catch (Throwable e) {
DLog.e(e);
}
return null;
}
IntentUtils.java 文件源码
java
阅读 36
收藏 0
点赞 0
评论 0
项目:nativead
作者:
评论列表
文章目录