android-sdcard

Trying to open Android SD card using HTML, Javascript and Phonegap

安稳与你 提交于 2019-12-24 07:59:02
问题 I am trying to open the SD card and upload a file in Android using Phonegap. Below is the code where I am appending the SD card content to my HTML, but nothing is displaying. I am using cordova.js , jquery1.7.1.js . Below is my code: My Javascript: function onDeviceReady() { getFileSystem(); } function getFileSystem() { window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSystem) { // success get file system root = fileSystem.root; listDir(root); }, function(evt) { // error

Android check for SD Card mounted always returns true

非 Y 不嫁゛ 提交于 2019-12-24 04:16:51
问题 I'm not sure what the source of the problem is - older android version with bug or if I'm doing something wrong, but my problem is that no matter what I do, android reports the SD card as mounted. Even if it's not physically in the tablet (archos 7o).. public boolean saveToDisk(String filename, String header) { /* first check to see if the SD card is mounted */ if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { //throw some exception so we can display an error

Content Resolver Query is not finding music on sd-card

我们两清 提交于 2019-12-24 03:51:31
问题 I have constructed a simple query to find music on the sdcard of the Android emulator. I am using Android Studio. I placed 3 songs on the sdcard using adb push. However, the query is not finding the music files. Here is an image of the files on the sdcard in the Music folder: Here is the code that I am using to perform the query: ContentResolver musicResolver = getContentResolver(); Uri musicUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; Cursor musicCursor = musicResolver.query(musicUri,

Can't create a directory in external sd card (Lollipop)

元气小坏坏 提交于 2019-12-24 03:30:02
问题 I have no problem with internal storage but I want to create a directory on the external SD card, with versions prior to KitKat, File.mkdirs() works. There is part of my code: //external sd card DocumentFile.fromFile(new File("/storage/sdcard1/")).exists(); //returns true DocumentFile.fromFile(new File("/storage/sdcard1/")).canRead(); //returns true DocumentFile.fromFile(new File("/storage/sdcard1/")).canWrite(); //returns true DocumentFile.fromFile(new File("/storage/sdcard1/test")).exists()

How to get absolute paths in the removable SD-card using Storage Access Framework (SAF)?

会有一股神秘感。 提交于 2019-12-24 01:25:16
问题 Is there any way to get the absolute path from specific Folders & Files located in the removable SD-card, using the Storage Access Framework (SAF)? Thanks 回答1: No, and even if you could, you would not be able to access them, unless they happened to be in one of the couple of locations on removable media for which you have read access (e.g., getExternalFilesDirs() ). The Storage Access Framework returns Uri values pointing to documents. Use ContentResolver and methods like openInputStream() to

Android (Write on external SD-Card): java.io.IOException: Permission denied

依然范特西╮ 提交于 2019-12-23 06:23:03
问题 I get a "Permission denied" error, when I want to create a file on my external SD-Card (named /storage/B9BE-18A6). I know that you have to ask for the write permission programmatically since Android M. So I inserted the solution from Arpit Patel (Android 6.0 Marshmallow. Cannot write to SD Card) I don't know why I still haven't the permissions to do it. Do you guys have another solution that I can create files on my SD-Card? Code for creating the file FloatingActionButton fab_new_file =

how can i get android inbuilt image gallery in to my application?

醉酒当歌 提交于 2019-12-23 04:50:43
问题 I have implemented an application for get the images from external storage when user click on a image button.if user click on a button i can get the images from sd card.but i can't view the slide show for get the images on by one there.I have implemented code as follows: ((ImageView)findViewById(R.id.getImage)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT);

Android - Better Approach in Loading SD CARD Images

南笙酒味 提交于 2019-12-23 04:29:40
问题 What is a better algorithm on loading or populating images from SD CARD, than storing each image path as Constants? public final class Constants { public static final String[] IMAGES = new String[] { // Heavy images "file:///mnt/sdcard/folder/folder/folder/1.jpg", "file:///mnt/sdcard/folder/folder/folder/2.jpg", "file:///mnt/sdcard/folder/folder/folder/3.jpg", "file:///mnt/sdcard/folder/4.jpg", ); } Basically I am learning the Universal Image Loader, and focusing on the grid view

Android 4.4 - create application dir on secondary sd card

雨燕双飞 提交于 2019-12-23 04:01:43
问题 I am aware about changes in Access to SD card introduced by Google with Android 4.4. However in my application I need to be able to store data on some removable /secondary sd card. When I create the application folder (app.xyz.com) on the secondary using default file manager then I am able to create dirs and files inside. But by default such dir dosen't exist on secondary sd card. So, I would like to create the application specific dir programmatically inside my application… Do you have any

Distinguish SDCard URI from USBStorage URI returned by SAF or StorageVolume API

穿精又带淫゛_ 提交于 2019-12-23 03:05:07
问题 I am using StorageVolume API to retrieve URI for both SDCard and USBStorage by following StorageManager storageManager = (StorageManager) getSystemService(STORAGE_SERVICE); for (StorageVolume storageVolume : storageManager.getStorageVolumes()) { if (!storageVolume.isPrimary()) { Intent accessIntent = storageVolume.createAccessIntent(null); startActivityForResult(accessIntent, 11); } } In onActivityResult I am able to retrieve the URI, saving it to the SharedPreferences and taking Persisting