android-sdcard

Find SD card volume label on Android

こ雲淡風輕ζ 提交于 2019-12-05 03:14:10
Is it possible to find out volume label of SD card inserted into Android device? I understand that Android is designed to have just one "external storage" (as returned by Environment.getExternalStorageDirectory() ), but there are quite a few devices in the wild that have internal flash as "external storage" and an SD card mounted under that or even wilder combinations (see this other question ). It is possible to enumerate these additional devices by reading /proc/mounts , but we need something to identify them to the user. Is there any chance to get to their volume labels? I checked that

Accessing Storage on the Nook

社会主义新天地 提交于 2019-12-05 00:51:47
问题 The closest thing to documentation I can find having to do with file storage is this post (see below if you can't access it), but it leaves me with several questions. I would really, really, really like a knowledgeable explanation of what paths map to what storage here, seeing as how we're supposed to hard-code them, and how precisely we're expected to access them. An actual code sample would be superlative. My best guess from messing around with this is that: /sdcard-> maps to the internal

How to play mp3 files from internal and external SD card in android?

一曲冷凌霜 提交于 2019-12-05 00:15:25
问题 I am working on a mp3 player app, which plays .mp3 files present anywhere inside an internal SD card. I have used the following codes to fetch the .mp3 files present in internal storage. ArrayList<File> inFiles = new ArrayList<File>(); File list[] = file.listFiles(); //Log.i("DIR", "PATH" +file.getPath()); for (int i = 0; i < list.length; i++) { // myList.add( list[i].getName() ); File temp_file = new File(file.getAbsolutePath(),list[i].getName()); //Log.i("DIR", "PATH" +temp_file

Android - get DocumentFile with write access for any file path on sd card (having allready gained sd card permission)

房东的猫 提交于 2019-12-04 23:08:42
问题 In my app I gain sd card write permission using the following intent. If the user selects the sd card folder from the system file explorer then I have sd card write access. Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE); intent.putExtra("android.content.extra.SHOW_ADVANCED", true); startActivityForResult(intent, 42); After that I am able to modify files in th sd card using the DocumentFile class. But I'm having problem getting a DocumentFile for a random file path. Document

How to delete all the files from sd card in android? [duplicate]

荒凉一梦 提交于 2019-12-04 22:00:37
This question already has answers here : Closed 7 years ago . Possible Duplicate: How to delete entire contents of sdcard programmatically in Android 2.2 I want to clear all the files from android device programmatically . Can anyone suggest me the way or code, Hence I can perform this operation please... Thanks in advance. public static boolean deleteDirectory(File path) { // TODO Auto-generated method stub if( path.exists() ) { File[] files = path.listFiles(); for(int i=0; i<files.length; i++) { if(files[i].isDirectory()) { deleteDirectory(files[i]); } else { files[i].delete(); } } } return

Writing to SD Card always failing

点点圈 提交于 2019-12-04 18:51:21
I am trying to move files from any location (including internal device storage) to SD Card, For that I Have <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> in my manifest, and checked that it did work by checking if premissions are granted using : Contex.checkCallingOrSelfPermission("android.permission.WRITE_EXTERNAL_STORAGE") and Contex.checkCallingOrSelfPermission("android.permission.READ_EXTERNAL_STORAGE") and I have tried 3 diffrent ways to do that : Files.move(original, newPath1),

How to create Android directory automatically if it doesn't already exist

﹥>﹥吖頭↗ 提交于 2019-12-04 15:53:26
问题 I am creating a gallery app using a tutorial but get the following error: abc directory path is not valid! Please set the image directory name AppConstant.java class Please visit the following link to see the entire tutorial's code as I am using the same code: http://www.androidhive.info/2013/09/android-fullscreen-image-slider-with-swipe-and-pinch-zoom-gestures/ I found this code in Utils Class: else { // image directory is empty Toast.makeText( _context, AppConstant.PHOTO_ALBUM + " is empty.

What is the differnce between accessing file from assets folder or SD card

烈酒焚心 提交于 2019-12-04 14:21:47
问题 I am developing an application where I have to use three different size's file (1mb, 5mb, 15mb). I searched, then came to know that we can keep these video in assets folder and can use those video. Secondly, I came to know that we can keep these videos in assets folder and installation time we can move all videos to SD card. when tried second approach faced problem due to bigger file size. So, can anyone please tell me what is difference between both approaches and which one I should use. Any

Android ACTION_IMAGE_CAPTURE with EXTRA_OUTPUT in internal memory

て烟熏妆下的殇ゞ 提交于 2019-12-04 09:15:28
When I'm taking a photo from a camera if I'm calling File file = new File(getFilesDir().getAbsolutePath() + "/myImage.jpg"); Uri outputFileUri = Uri.fromFile(file); cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri); OK button on camera app is not functioning, simply does nothing (actually won't save it to internal memory I provided I guess and therefore the app itself does nothing). If I however call File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/myImage.jpg"); Uri

Problem Pushing Large File to Emulator/SDcard with Eclipse DDMS

不打扰是莪最后的温柔 提交于 2019-12-04 05:48:15
I am using Eclipse DDMS to push a file over onto my Android Emulator sdcard. I select the file and press Open, a dialog pops up and starts pushing the file. In the view "File Explorer" in the DDMS perspective I can see the sdcard directory and can see my file created in it. Then in the popup the progress meter gets halfway then I get this error in the Console window: [2011-09-22 15:15:56] Failed to push the item(s). [2011-09-22 15:15:56] (null) Then the File Explorer completely refreshes and the file disappears. I know the sdcard is setup for 1G of space and the file I am pushing is only 9M.