private InputStream loadResourceFromUri(Uri uri, ContentResolver contentResolver)
throws FileNotFoundException {
switch (URI_MATCHER.match(uri)) {
case ID_CONTACTS_CONTACT:
return openContactPhotoInputStream(contentResolver, uri);
case ID_CONTACTS_LOOKUP:
// If it was a Lookup uri then resolve it first, then continue loading the contact uri.
uri = ContactsContract.Contacts.lookupContact(contentResolver, uri);
if (uri == null) {
throw new FileNotFoundException("Contact cannot be found");
}
return openContactPhotoInputStream(contentResolver, uri);
case ID_CONTACTS_THUMBNAIL:
case ID_CONTACTS_PHOTO:
case UriMatcher.NO_MATCH:
default:
return contentResolver.openInputStream(uri);
}
}
StreamLocalUriFetcher.java 文件源码
java
阅读 30
收藏 0
点赞 0
评论 0
项目:GitHub
作者:
评论列表
文章目录