0

I use this code for save image to sd card :

URL url = new URL(downloadPath);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.connect();
int fileSize = connection.getContentLength();

int len = 0;
int downloadedSize = 0;

FileOutputStream outputStream = new FileOutputStream(filepath);
InputStream inputStream = connection.getInputStream();
byte[] buffer = new byte[G.DOWNLOAD_BUFFER_SIZE];
while ((len = inputStream.read(buffer)) > 0) {
     outputStream.write(buffer, 0, len);
     downloadedSize += len;
     downloadPercent = (float) (100.0 * (float) downloadedSize / fileSize);
}

outputStream.close();

But after save , in gallery is shown

I want save to sd card but not shown in gallery

Mohammad
  • 111
  • 2
  • 13

1 Answers1

0

Add .nomedia file inside the folder.

Understand the concept of nomedia file Link