android-sdcard

Android 5.0 DocumentFile from tree URI

江枫思渺然 提交于 2020-01-09 09:39:49
问题 Alright, I've searched and searched and no one has my exact answer, or I missed it. I'm having my users select a directory by: Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE); startActivityForResult(intent, READ_REQUEST_CODE); In my activity I want to capture the actual path, which seems to be impossible. protected void onActivityResult(int requestCode, int resultCode, Intent intent){ super.onActivityResult(requestCode, resultCode, intent); if (resultCode == RESULT_OK) { if

Get all storages and devices with their names android

前提是你 提交于 2020-01-07 07:41:11
问题 I already found out how to get all storages with either of these answers: with proc/mounts and with mount command, but now I want to put a name on the paths returned. I have no problem with Internal Storage, however these methods can't distinguish between a SD card and a USB stick. If it sees two drives connected how can I be sure which one is the SD Card and which is the USB, or are they two SD Cards? Or two USB drives? 回答1: I found part of the solution, however I won't get any farther

Unable to create file on removeable sdcard in Android 5.0.1

时光总嘲笑我的痴心妄想 提交于 2020-01-06 15:10:22
问题 I am working on an application that needs the ability to create files on the removable sd card in the Samsung S4 i9295 device. I am running a stock Samsung ROM 5.0.1 that has been rooted. For test purposes, I have been trying to create these files by hardcoding the paths for this specific device, but have been unable to create files on the removable card. The code below creates files as expected on the internal sd card but not on the removable card. //creates directory on internal sdcard

Can't get files with ExternalStorageDirectory

强颜欢笑 提交于 2020-01-06 01:06:58
问题 I found that when I use code below it works on AVD, but when I open it on physical device or Bluestacks - the list is empty, even though that music files are on sdcard. Anyone knows what is going on? And, if You know how to make it read files from internal memory I would be grateful, cause as I found out - many phones have big memory capacity and they don't use sd cards (some of them even can't). Here's the code: static Uri[] mUris; static String[] mFiles = null; public static String[]

Can't get files with ExternalStorageDirectory

↘锁芯ラ 提交于 2020-01-06 01:06:29
问题 I found that when I use code below it works on AVD, but when I open it on physical device or Bluestacks - the list is empty, even though that music files are on sdcard. Anyone knows what is going on? And, if You know how to make it read files from internal memory I would be grateful, cause as I found out - many phones have big memory capacity and they don't use sd cards (some of them even can't). Here's the code: static Uri[] mUris; static String[] mFiles = null; public static String[]

Android emulator sd card image already in use

﹥>﹥吖頭↗ 提交于 2020-01-04 13:26:32
问题 I have followed the answers from this question without success. I could not respond to the posted answer (lack of reputation) so I had to make a new question. Purging all adb processes does not alleviate the 'SD Card image already in use' error. Similarly, if I delete the SD card image, create a new one, then immediately launch the emulator, the error persists. After the emulator loads to the phone home screen, an "SD Card Removed" message is displayed. Here is what my command line looks like

Android emulator SDCard is removed for some reason

允我心安 提交于 2020-01-04 02:15:09
问题 I've created in the AVD a 3.2 (With Google APIs) device. However, I lately can't seem to be able to use the SDCard, when using: Environment.getExternalStorageState(); I receive "removed". How can I remount / unremove the SDCard? (I've tried creating new devices, and restarting the device many times). I'm working on Windows 7 with Eclipse 2010, if it matters. Thanks, Gal 回答1: use this code Intent i = new Intent(android.provider.Settings.ACTION_MEMORY_CARD_SETTINGS); startActivity(i); and then

Getting the path to SD card

冷暖自知 提交于 2020-01-02 11:06:46
问题 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

Android;Force AppWidget to work from SD Card?

无人久伴 提交于 2020-01-02 08:34:41
问题 Is there any way to force AppWidget to work even App is moved to the SD Card and SD Card is not unmounted ? Docs say: ... you should not allow your application to be installed on the external storage if it uses any of the following features, due to the cited consequences when the external storage is unmounted : ... App Widgets Your App Widget will be removed from the home screen. When external storage is remounted, your App Widget will not be available for the user to select until the system

Android 4.4 Kitkat and second external storage

有些话、适合烂在心里 提交于 2020-01-01 06:45:12
问题 There has been written a lot about Kitkat external sdcard write permission but it's not clear to me how it works. Unfortunately I don't have Kitkat device with sdcard slot. Question is, can I write to secondary external storage at all? Based on the docs. Apps must not be allowed to write to secondary external storage devices, except in their package-specific directories If in understand it, If I don't have permission I can write to the app specific folder on primary external storage /sdcard