android-external-storage

Downloads the same file twice?

前提是你 提交于 2019-12-08 05:21:30
Hi i've been looking through various parts of my code to try and find out whats happening but can't seem to figure it out. The following code is supposed to be downloading two files one called "clientraw" and one called "clientrawextra" but for some reason when i look in the directory there are 2 versions of each file "clientraw...1..." "clientrawextra...1..." Therefore it seems like it's downloading the files multiple times and i have no idea why?? Thanks in advance! distance dis = new distance(); dis.findURL(value); String url = dis.findURL(value); DownloadManager.Request request = new

Downloads the same file twice?

混江龙づ霸主 提交于 2019-12-08 04:23:21
问题 Hi i've been looking through various parts of my code to try and find out whats happening but can't seem to figure it out. The following code is supposed to be downloading two files one called "clientraw" and one called "clientrawextra" but for some reason when i look in the directory there are 2 versions of each file "clientraw...1..." "clientrawextra...1..." Therefore it seems like it's downloading the files multiple times and i have no idea why?? Thanks in advance! distance dis = new

Android 4.4.2 not deleting files

余生颓废 提交于 2019-12-08 01:59:30
问题 I have a peice of code that scans for all files in a directory and it should delete those files. But for some reason it's not deleting them. What I have is this: String path = Environment.getExternalStorageDirectory().getAbsolutePath()+"/Images/"; File f = new File(path); File file[] = f.listFiles(); for (File aFile : file) { boolean isDeleted = aFile.delete(); if(isDeleted) { log.d("file", "is deleted"); } } When I debug this code then it says for every file that isDeleted is true . But when

Recommended path for caching images on external memory / sd card

泄露秘密 提交于 2019-12-07 12:35:27
问题 When I look at my sd card root directory in Android file transfer or Astro file manager it's a mess because apps are storing files all over the place. As developers we follow best practice by caching images/files etc to make our apps quicker and we use Environment.getExternalStorageDirectory() to get the root of the external storage (not hardcoding /sdcard). But what should go next? ideal world we'd follow a convention for dumping our cached files on the open field that is the external

NPE on Environment.getExternalStorageState()?

丶灬走出姿态 提交于 2019-12-06 16:11:06
问题 Cannot find the reason why I am getting "Null pointer exception" . I could give an explicit check to see if "getStorageState is null" but that doesnt explain why I am getting this error. The error is : java.lang.NullPointerException at android.os.Environment.getStorageState(Environment.java:719) at android.os.Environment.getExternalStorageState(Environment.java:694) at com.ciqual.android.insight.sessionService.RemoveFiles(SessionService.java:664) com.vyshas.android.sessionService.onEndSession

How does the multi-user feature work in terms of paths on Android?

为君一笑 提交于 2019-12-06 10:42:59
问题 background Starting with version 4.2 , Android supports multi-user (link here and here). Each user has its apps and their private data is visible just for the user. The question How does the encapsulation of the data per user work in terms of paths and accessing files? I mean, what will be the paths per each user for: the private, internal storage. the emulated external storage (built in external storage) the "real" external storage (sd cards) ? I guess users can see the data stored on the sd

Android Things filesystem

一笑奈何 提交于 2019-12-06 09:55:39
I am building this app on android things. I want to be able to give it access to media files on a USB stick or maybe even the raspberry pi's SDcard. I don't know what I'll have it do with those files yet but I just wanna know if its possible. If it isn't that's fine I have other solutions but I figured I would start with the obvious approach first. I'm didn't try it, but seems it's possible by the same way as in normal Android OS. To do this You should mount Your USB dongle into the filesystem somewhere e.g. in new folder /mnt/usb like in this answer of Onik or that project of Keval Patel :

Getting the path to SD card

为君一笑 提交于 2019-12-06 09:40:34
Please read the whole post before down-voting and/or marking it as a duplicate! I'm working on an app that reads files from within a specific folder on the user's phone - either from the SD card (if there's one) or from the built in storage. Yes, the "READ_EXTERNAL_STORAGE" is mentioned in the manifest and I'm also handling the permission popup for API>23. I used to simply use File folder = new File(Environment.getExternalStorageDirectory(), "myfolder"); to get the path of the folder that is stored in the built in storage (32gb for an S7) but now I want to get the path to the SD card.

Failed to create directory in Android Oreo (API 26)

梦想与她 提交于 2019-12-06 09:37:17
I have already read the documentation for Android Oreo's Behavior and changes. I know there is different procedure to create file directory for Android Oreo (API 26) Code : File mediaStorageDir = null; if (Build.VERSION.SDK_INT >= 26) { mediaStorageDir = new File(Environment.getExternalStorageDirectory().toString(), "MyDirectory"); Log.v("HEREEEEE","YES"); } else { mediaStorageDir = new File(Environment.getExternalStorageDirectory().toString() + File.separator + "MyDirectory"); } if (!mediaStorageDir.exists()) { if (!mediaStorageDir.mkdirs()) { Toast.makeText(RecordVideoActivity.this, "Failed

External Storage Path (SD card) for Android 5.1.1 and later with Cordova

纵饮孤独 提交于 2019-12-06 08:18:53
问题 I am working to develop an android APP with cordova,I wanted to create an folder everyday and store a txt file in it. everything I tried is working for the internal memory of each android but not for the External SD card, have a look and help me out, if(sDeviceVersion=='4.0' || sDeviceVersion=='4.0.4'){ var sPath = 'file:///storage/extSdCard/'; }else if(sDeviceVersion=='4.1' || sDeviceVersion=='4.1.2' ||sDeviceVersion=='4.3.1'){ var sPath = 'file:///storage/extSdCard/'; }else if