`
wang_peng1
  • 浏览: 3904821 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

查询获得图片picture URI.

 
阅读更多

public Uri getPhotoUri() { 
       
Uri person = ContentUris.withAppendedId( 
               
ContactsContract.Contacts.CONTENT_URI, Long.parseLong(getId())); 
       
Uri photo = Uri.withAppendedPath(person, 
               
ContactsContract.Contacts.Photo.CONTENT_DIRECTORY); 
 
       
Cursor cur = this.ctx 
               
.getContentResolver() 
               
.query( 
                       
ContactsContract.Data.CONTENT_URI, 
                       
null, 
                       
ContactsContract.Data.CONTACT_ID 
                               
+ "=" 
                               
+ this.getId() 
                               
+ " AND " 
                               
+ ContactsContract.Data.MIMETYPE 
                               
+ "='" 
                               
+ ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE 
                               
+ "'", null, null); 
       
if (cur != null) { 
           
if (!cur.moveToFirst()) { 
               
return null; // no photo 
           
} 
       
} else { 
           
return null; // error in cursor process 
       
} 
       
return photo; 
   
} 

分享到:
评论

相关推荐

    前端项目-URI.js.zip

    前端项目-URI.js,uri.js是一个用于处理URL的JavaScript库。

    Win10系统如何使用URI.docx

    Win10系统如何使用URI.docx

    小儿呼吸道特点急性上呼吸道感染AURI.ppt

    小儿呼吸道特点急性上呼吸道感染AURI.ppt

    angular-uri:一个允许URI.js依赖注入的角度模块

    script type =" text/javascript " src =" bower_components/uri.js/src/URI.js " > </ script > 在angular.js和URI.js之后包括angular-uri < script type =" text/javascript " src =" bower_...

    uri.rar_generic

    set of generic URI related routines.

    uri.c:URI 组件编码器解码器

    uri.c URI 组件编码器/解码器安装$ clib install littlstar/uri.c用法# include < uri> # include < stdio># include < string># include " uri.h "intmain ( void ) { char *enc = NULL ; char *dec = NULL ; enc =...

    URI.zip_This Is It_uri

    It s little try to implement a URI class fpr Visaul C++. So everybody who is interestet my first try look at this files.

    URI.rar_universal

    关于URI的说明,大家可以侃侃,Web上可用的每种资源 - HTML文档、图像、视频片段、程序等 - 由一个通过通用资源标志符(Universal Resource Identifier, 简称"URI")进行定位。

    URI.rar_android

    常用的Uri大全,对于Android开发人员来说很有用。

    URI.js:JavaScript URL突变库

    URI.js重要提示:您可能不再需要URI.js ! 现代浏览器提供和接口。 注意: npm软件包名称已更改为urijs 在查看如下代码时,我总是想把自己的脑袋开枪: var url = "http://example.org/foo?bar=baz" ;var separator ...

    URI.rar_C++

    one of my solved problem

    支持jdk8版本dubbo-admin

    org.springframework.beans.NotWritablePropertyException: Invalid property 'URIType' of bean class [com.alibaba.citrus.service.uribroker.uri.GenericURIBroker]: Bean property 'URIType' is not writable ...

    android ProviderTest

    数据库共享的例子,由 Provider提供

    android获取图片尺寸的两种方式及bitmap的缩放操作

    我就废话不多说了,大家还是直接看代码吧~ //Uri.parse(file://+result.getImage... //方法一:通过uri把图片转化为bitmap的方法 Bitmap bitmap= BitmapFactory.decodeFile(path); int height= bitmap.get

    Android Intent调用 Uri的方法总结

    Android Intent调用 Uri的方法总结 //调用浏览器 Uri uri = Uri.parse(); Intent it = new Intent(Intent.ACTION_VIEW,uri); startActivity(it); //显示某个坐标在地图上 Uri uri = Uri.parse(geo:38.899533,-...

    CI框架源码解读之URI.php中_fetch_uri_string()函数用法分析

    本文实例讲述了CI框架URI.php中_fetch_uri_string()函数用法。分享给大家供大家参考,具体如下: APPPATH/config/config.php中对于url 格式的拟定。 $config['uri_protocol'] = 'AUTO'; 这个配置项目定义了你使用...

    uri-js-rails:URI.js用于Rails资产管道

    Uri :: Js :: Rails Rails的 安装 将此行添加到您的应用程序的Gemfile中: gem 'uri-js-rails', :group => :assets 然后执行: $ bundle 或将其自己安装为: $ gem install uri-js-rails 用法 添加到您的...

    zuri:Zig的URI解析器

    const uri = try Uri. parse ( "https://ziglang.org/documentation/master/#toc-Introduction" ); assert (mem. eql ( u8 , uri.scheme, "https" )); assert (mem. eql ( u8 , uri.host, "ziglang.org" )); assert...

    uri.dart:在Dart中使用URI的实用程序

    Dart中用于处理的实用程序,主要用于解析和生成URI。 UriPattern UriPattern是用于匹配和解析URI的类的接口,就像是用于String的接口一样。 它定义了方法bool matches(Uri uri)和UriMatch match(Uri uri) 。 ...

Global site tag (gtag.js) - Google Analytics