码迷,mamicode.com
首页 > 其他好文 > 详细

操作系统相册和获取相册路径

时间:2014-07-24 21:56:22      阅读:222      评论:0      收藏:0      [点我收藏+]

标签:blog   http   io   art   for   re   c   cti   

Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null);
intent.setType(IMAGE_TYPE);
startActivityForResult(intent, 2);

 

ContentResolver resolver = getContentResolver();

try {
Uri uri = data.getData();
bitmap = MediaStore.Images.Media.getBitmap(resolver, uri);
bm = ThumbnailUtils.extractThumbnail(bitmap, 300, 150);
handler.sendEmptyMessage(1);

//获取图片路径
String[] porj = {MediaStore.Images.Media.DATA};
Cursor cursor = managedQuery(uri, porj, null, null, null);
int index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
String path = cursor.getString(index);

LogUtils.v("相册路径:"+path);

} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

参考:http://blog.csdn.net/hugh114/article/details/5765332

操作系统相册和获取相册路径,布布扣,bubuko.com

操作系统相册和获取相册路径

标签:blog   http   io   art   for   re   c   cti   

原文地址:http://www.cnblogs.com/zfg-technology/p/3865856.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!