库项目不更新,而文件下载 [英] Gallery item is not updated while file downloading
本文介绍了库项目不更新,而文件下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我下载从我的应用程序的视频但这视频目前无法显示的画廊,现在我只是重新启动我的设备,然后显示在画廊的项目。我不明白为什么,是任何视频标签的文件,该文件会告诉机器人在多媒体视频添加此项目设置。
I am downloading a video from my application but that video is not currently show in gallery, Now i just restart my device and then it shows in gallery item. I don't understand why, Is any video tag set with the file which will tell android to add this item in gallery video.
这是我的code
FileOutputStream fos = new FileOutputStream(filePath);
long total = 0;
int len = 0;
byte[] buf = new byte[1024];
while ((len = inputStream.read(buf)) > 0) {
if(!cancel)
{
fos.write(buf, 0, len);
// send update
total = total + len;
}
else
{
File f = new File(filePath);
System.out.println("Path is=========="+f.getAbsolutePath());
if(f.exists())
f.delete();
cancel = false;
break;
}
}
请帮忙,谢谢提前
推荐答案
香港乐施会,我发现,只要将下载已完成我自己的问题的回答只是添加此行下方
Ohk i found my own question's answer just add this below line whenever download will have been completed
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(new File(filePath))));
这篇关于库项目不更新,而文件下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文