android-mediascanner

MediaScannerConnection doesn't work

狂风中的少年 提交于 2021-01-29 12:47:02
问题 public void onClick(View v) { // Writing data to file FileWriter fw; try { fw = new FileWriter(Environment.getExternalStorageDirectory()+"/DataLog.csv", true); BufferedWriter br = new BufferedWriter(fw); br.append(formattedDate + String.valueOf(location.getLatitude()) + ";" + String.valueOf(location.getLongitude()) + ";" + String.valueOf(location.getSpeed()) + ";" + String.valueOf(location.getBearing()) + ";" + String.valueOf(location.getAltitude()) + ";" + String.valueOf(location.getAccuracy

I can successfully download image in my phone storage but not showing in gallery before phone reboot

风格不统一 提交于 2020-07-13 16:08:24
问题 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: The red file is the downloaded file in question. The green image file is a file I manually dragged into the directory through Windows Explorer. my code is here please place saved file using MediaScannerConnection: package com.romantic.coupleposts; import android.app.Activity; import android.app

I can successfully download image in my phone storage but not showing in gallery before phone reboot

早过忘川 提交于 2020-07-13 16:02:08
问题 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: The red file is the downloaded file in question. The green image file is a file I manually dragged into the directory through Windows Explorer. my code is here please place saved file using MediaScannerConnection: package com.romantic.coupleposts; import android.app.Activity; import android.app

I can successfully download image in my phone storage but not showing in gallery before phone reboot

别来无恙 提交于 2020-07-13 15:55:02
问题 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: The red file is the downloaded file in question. The green image file is a file I manually dragged into the directory through Windows Explorer. my code is here please place saved file using MediaScannerConnection: package com.romantic.coupleposts; import android.app.Activity; import android.app

I can successfully download image in my phone storage but not showing in gallery before phone reboot

一世执手 提交于 2020-07-13 15:54:22
问题 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: The red file is the downloaded file in question. The green image file is a file I manually dragged into the directory through Windows Explorer. my code is here please place saved file using MediaScannerConnection: package com.romantic.coupleposts; import android.app.Activity; import android.app

I can successfully download image in my phone storage but not showing in gallery before phone reboot

与世无争的帅哥 提交于 2020-07-13 15:53:37
问题 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: The red file is the downloaded file in question. The green image file is a file I manually dragged into the directory through Windows Explorer. my code is here please place saved file using MediaScannerConnection: package com.romantic.coupleposts; import android.app.Activity; import android.app

How to correctly notify MediaScanner about a folder, even on Nexus/Kitkat devices?

懵懂的女人 提交于 2020-01-22 14:08:17
问题 Background I'm making an app that downloads some images from the Internet into a specific folder that is defined as: final String pathToPutFiles = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + File.separator + DOWNLOAD_FOLDER_NAME; I wish to make the gallery and any app that shows media, to be notified of those images and be able to show them. Sadly I'm having problems on Nexus 4, which has Kitkat version (4.4.2 to be exact). Sometimes it works and sometimes

Android mediaScannerConnection.scanFile failing to refresh images in gallery

蓝咒 提交于 2020-01-02 11:20:12
问题 Should I be using something other than the MediaScannerConnection.scanFile method to refresh the gallery? After saving a new jpg I run media scanner to refresh the gallery app like so MediaScannerConnection.scanFile(this, new String[] { fullname }, null, new MediaScannerConnection.OnScanCompletedListener() { public void onScanCompleted(String path, Uri uri) { Log.d("ExternalStorage", "@@@@ Scanned " + path + ":"); Log.d("ExternalStorage", "@@@@ -> uri=" + uri); } }); The output of the log