Search code examples
androidandroid-gallery

.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


Solution

  • 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