简体   繁体   中英

.nomedia folder not working to hide pics?

i am using universal image loader to load the images and i am using the download button to download the images

here is the downloading code

DownloadManager mgr = (DownloadManager) this
                        .getSystemService(Context.DOWNLOAD_SERVICE);

                Uri downloadUri = Uri.parse(imageUrls[NUMBER]);
                DownloadManager.Request request = new DownloadManager.Request(
                        downloadUri);

                request.setAllowedNetworkTypes(
                        DownloadManager.Request.NETWORK_WIFI
                                | DownloadManager.Request.NETWORK_MOBILE)
                        .setAllowedOverRoaming(false)
                        .setTitle("Demo")
                        .setDescription("Something useful. No, really.")
                        .setDestinationInExternalFilesDir(this,getFilesDir()+"/fname/." + publicationID,
                                "image" + NUMBER + ".jpg");
mgr.enqueue(request);

up to here its working fine

the problem is i don't want to show the downloaded images in gallery

i tried ".nomedia" file and folder .. no luck

thanks for your time , waiting for the response

Try to use:

".image" + NUMBER + ".jpg"

instead of

"image" + NUMBER + ".jpg"

i ran the media scan after the download .. its working now

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

thanks @axius

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM