title: Downloaded image showing in android studio but not gallery
body: <p>I am trying to download an image using a url through a service I've created and when I inspect my device's file directory through Android Studio debugger, I can see the file in the device:</p>
  
  <p><strong>The red file is the downloaded file in question. The green image file is a file I manually dragged in to the directory through Windows Explorer.</strong></p>
  
  <p><a href="https://i.stack.imgur.com/zyO4M.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zyO4M.jpg" alt="enter image description here"></a></p>
  
  <p>I can successfully see and open the green file in my Gallery app but the red file (and all the other files listed in that directory) are no where to be found. I cannot see them in Windows Explorer either. Am I supposed to identify them as images somewhere in my code so that the file system knows it's an image?</p>
  
  <p>This is the part where I download the image:</p>
  
  <pre><code>Request.Builder builder = new Request.Builder();
  builder = builder.url(downloadFileUrl);
  builder = builder.addHeader("RANGE", "bytes=" + existLocalFileLength);
  Request request = builder.build();
  
  Call call = okHttpClient.newCall(request);
  Response response = call.execute();
  
  if (response != null &amp;&amp; response.isSuccessful()) {
   RandomAccessFile downloadFile = new RandomAccessFile(existLocalFile, "rw");
   downloadFile.seek(existLocalFileLength);
  
   ResponseBody responseBody = response.body();
   InputStream inputStream = responseBody.byteStream();
   BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
   byte data[] = new byte[102400];
  
   long totalReadLength = 0;
  
   int readLength = bufferedInputStream.read(data);
  
   while (readLength != -1) {
  
    if (getDownloadManager().isDownloadPaused()) {
     ret = DOWNLOAD_PAUSED;
     break;
    } else if (getDownloadManager().isDownloadCanceled()) {
     ret = DOWNLOAD_CANCELED;
     break;
    } else {
  
     downloadFile.write(data, 0, readLength);
  
     totalReadLength = totalReadLength + readLength;
  
     int downloadProgress = (int)((totalReadLength + existLocalFileLength) * 100 / downloadFileLength);
  
     getDownloadManager().updateTaskProgress(downloadProgress);
  
     readLength = bufferedInputStream.read(data);
    }
   }
  }
  </code></pre>