POUYA KARIMI
POUYA KARIMI

Reputation: 327

how to hide picture from gallery but show in storage of system?

I have an application that download picture from internet.I want when download picture don't show in gallery but show in SD card and folder because the user can delete the file. Like of telegram. When i add . first of name of file hide from everywhere

Upvotes: 0

Views: 213

Answers (2)

Sangeeta
Sangeeta

Reputation: 991

Here is the code:

private void createNoMedia() {
        final File nomedia = new File(getConversationsFileDirectory()+".nomedia");
        if (!nomedia.exists()) {
            try {
                nomedia.createNewFile();
            } catch (Exception e) {
                Log.d(Config.LOGTAG, "could not create nomedia file");
            }
        }
    }

public static String getConversationsFileDirectory() {
        return  Environment.getExternalStorageDirectory().getAbsolutePath()+"/YourFolder/";
    }

Upvotes: 1

albeee
albeee

Reputation: 1472

Try this.

  1. Download a image file using your application instead of using default download manager API.
  2. Save a file with a different extension which is not jpg or png or any other image ext.
  3. Only your app can understand the extension and display it as a image.

Upvotes: 0

Related Questions