的Andr​​oid如何使用MediaScannerConnection SCANFILE [英] Android How to use MediaScannerConnection scanFile

查看:536
本文介绍了的Andr​​oid如何使用MediaScannerConnection SCANFILE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

林将图像添加到对SD卡的文件夹。 由于图像和我的文件夹是不是在画廊IM立即可见 试图让MediaScannerConnection更新和显示 文件夹/图像画廊。 这不是工作,所以对我好,因为没有显示在画廊。 我只是在测试在Eclipse AVD。

我不明白这个多谈,也许是因为SCANFILE是新的,因为api8。 可能有人展示如何做到这一点?

我试着它既有服务和活动,但不断收到 URI = NULL onScanCompleted时。

解决方案

  sendBroadcast(新意图(Intent.ACTION_MEDIA_MOUNTED,Uri.parse(文件://
            + Environment.getExternalStorageDirectory())));
 

Im adding images to a folder on the SDCARD. Since the images and my folder is not immediately visible in the Gallery im trying to get the MediaScannerConnection to update and show the folder/images in the gallery. This is not working so good for me since nothing shows up in Gallery. Im only testing in Eclipse AVD.

I dont see much talk about this maybe because the scanFile is new since api8. Could someone show how this is done?

Im trying it in both a service and Activity but keep getting uri=null when onScanCompleted.

解决方案

sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://"
            + Environment.getExternalStorageDirectory()))); 

这篇关于的Andr​​oid如何使用MediaScannerConnection SCANFILE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆