【发布时间】:2016-07-30 15:09:15
【问题描述】:
我正在从服务器下载图像并将其保存在内部存储中。但我想从图库中隐藏这些图像。我该怎么做?
我听说带有.DirName 的命名文件夹会隐藏图像,但在我的情况下它不起作用。 (手机未root)
public void myDownload(String myURL) {
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(myURL));
//request.setTitle("File Download");
//request.setDescription("Downloading....");
//request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI);
request.allowScanningByMediaScanner();
//request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN);
String nameOfFile = URLUtil.guessFileName(myURL, null, MimeTypeMap.getFileExtensionFromUrl(myURL));
//request.setDestinationInExternalPublicDir(Environment.getExternalStorageDirectory().getPath() + "/KiiTTimeTableData/" + year + "/" + branch + "/" + section + "/", nameOfFile);
//request.setDestinationInExternalPublicDir("/MyDataFinal/", nameOfFile);
request.setDestinationInExternalPublicDir("/KiiTTimeTableData/Data/", nameOfFile);
DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
manager.enqueue(request);
}
【问题讨论】:
标签: android android-image android-gallery