android-external-storage

Issues traversing through directory hierarchy with Android Storage Access Framework / DocumentProvider using MTP

核能气质少年 提交于 2019-12-20 04:54:09
问题 UPDATE: My initial question may be misleading so I want to rephrase it: I want to traverse through the hierarchy tree from an MTP connected device through Android's Storage Access Framework. I can't seem to achieve this because I get a SecurityException stating that a subnode is not a descendant of its parent node. Is there a way to workaround this issue? Or is this a known issue? Thanks. I'm writing an Android application that attempts to traverse and access documents through the hierarchy

WRITE_EXTERNAL_STORAGE not working on lollipop even though it's set in the manifest

核能气质少年 提交于 2019-12-19 05:52:44
问题 I'm trying to save images from the apps local data folders to external storage. My manifest contains the following (before the manifest's application tags): <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18"/> When I try the following try { InputStream in = new FileInputStream(filePath); File outPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY

android get all external storage path for all devices

前提是你 提交于 2019-12-19 04:21:33
问题 getExternalStorageDirectory() return SD card path on my phone. ( Huawei Y320 - android 4.2.2 ). now, how to get path Phone Storage path for all devices and all API? loot at bottom screenshot. 回答1: I'm using this method: public static final String SD_CARD = "sdCard"; public static final String EXTERNAL_SD_CARD = "externalSdCard"; private static final String ENV_SECONDARY_STORAGE = "SECONDARY_STORAGE"; public static Map<String, File> getAllStorageLocations() { Map<String, File> storageLocations

Copy file from the internal to the external storage in Android

不打扰是莪最后的温柔 提交于 2019-12-19 02:54:56
问题 My app ( Android API 15 ) makes a picture and stores it in the internal memory's folder. Now, I want to copy this file to another folder inside of the external storage, e.g. /sdcard/myapp . I tried the following approaches: Approach #1: private void copyFile(File src, File dst) throws IOException { File from = new File(src.getPath()); File to = new File(dst.getPath()); from.renameTo(to); } Approach #2: private void copyFile(File src, File dst) throws IOException { FileChannel inChannel = null

Access external storage in File Chooser

怎甘沉沦 提交于 2019-12-18 07:13:04
问题 I am trying to implement a File Chooser. I am using Android File Explore for file chooser in my app. When I run the app, it shows me Internal storage and returns me the file path, but it doesn't show External Storage at all. This is my AndroidManifest.xml file. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unicloud.mittal" > <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name=

How does storage access change on Android 6?

二次信任 提交于 2019-12-17 22:05:15
问题 Background Android had a lot of changes as to how to handle the SD-card and storage in general: API 3 - you get all access, no permission needed API 4-15 - you need to use WRITE_EXTERNAL_STORAGE, and you get all access. API 16-18 - if you wish only to read, use READ_EXTERNAL_STORAGE API 19-20 - you can't read or write to secondary external storage (SD-card), unless your app is a system app, or you have root. API 21-22 - in order to access the SD-card, you need to ask the user for permission,

Files created on external storage do not show up when device is mounted on Windows/Mac

为君一笑 提交于 2019-12-13 14:55:13
问题 I have a simple application that attempts to save some data to external storage on Android device (Nexus 4) to be later retrieved on PC (Windows or Mac). The writing succeeds but when i try to retrieve the file using Android File Transfer on Mac or by Explorer on Windows the MyApp directory just isn't there. If i use 'Root Explorer' app on the device itself i can see the directory and the file and all permissions look ok. The application code is along the following lines: File extStorageDir =

How can I make a file to disappear once if it is deleted in android SD card?

心不动则不痛 提交于 2019-12-13 07:31:05
问题 /*Files will be clicked here*/ @Override protected void onListItemClick(ListView l,View v, final int position, long id){ filePosition=new File(path1.get(position)); System.out.println("File position:"+filePosition); if(filePosition.isDirectory()){ if(filePosition.canRead()) getDirectories(path1.get(position)); else { new AlertDialog.Builder(VideoSDcard.this) .setIcon(R.drawable.folder) .setTitle("["+filePosition.getName()+"]folder can't be read!") .setPositiveButton("Ok", new DialogInterface

differences between /sdcard/emulated/0 and /sdcard

人盡茶涼 提交于 2019-12-12 08:21:40
问题 I'm goig to be mad with a strange issue. If i create a folder inside my code as directory_path = Environment.getExternalStorageDirectory() + "/" + context.getResources().getString(R.string.app_name); directory = new File(directory_path); if (!directory.exists()) { directory.mkdirs(); } a new folder is created inside /sdcard/ . If i try to print on logcat directory_path variable, the path is different: /storage/emulated/0/ and if i go to that path, i found another folder with the same name of

what's the directory of external storage on nexus LG

百般思念 提交于 2019-12-12 05:49:58
问题 The following code snippet is trying to store a Gesture object. private Gesture mGesture; private GestureLibrary store; store.addGesture("test", mGesture); store.save(); I'm wondering where is mGesture stored? Just followed by the above code, the author gives the following code: final String path = new File(Environment.getExternalStorageDirectory(), "gestures").getAbsolutePath(); Toast.makeText(this, getString(R.string.save_success, path), Toast.LENGTH_LONG).show(); So I guess the mGesture is