android-sdcard

Caused by: java.lang.IllegalStateException: Unable to create directory in Android 6.0 devices

天大地大妈咪最大 提交于 2019-12-01 18:34:46
问题 I have to store the download the image from the url using DownloadManager and store it into the sdcard with my own directory like "xyz". This is my code File img_directory = null; img_directory = new File(Environment.getExternalStorageDirectory() + "/xyz"); if (!img_directory.exists()) { img_directory.mkdirs(); DownloadManager mgr = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE); Uri downloadUri = Uri.parse("my image url"); DownloadManager.Request request = new DownloadManager

Why is AssetManger.list() so slow?

你说的曾经没有我的故事 提交于 2019-12-01 16:50:57
I'm trying to populate a ListView with a mixture of files stored on the SDcard AND stored as assets in the APK. Using TraceView , I can see that the performance of AssetManager.list() is poor in comparison to File.listFiles() , even though I'm using a filename filter for the SDcard. Here is a simple method that returns all the png files from a folder on the SDcard: // The folder on SDcard may contain files other than png, so filter them out private File[] getMatchingFiles(File path) { File[] flFiles = path.listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { name =

Can't write file on SD-card

梦想与她 提交于 2019-12-01 12:15:29
I'm trying to write a photo on the SD card without success. I've got the permissions to write in the removable storage and the sd card is mounted. Also, I checked that the path to the SD card exists and I have obtained a positive result. Where it fails is when I use the mkdir() function. It returns false and no file is created. I have tested on both a Samsung A6(Marshmallow) and a Samsung Tab4(Lollipop) This is the snippet of code I'm using to retrieve the path to the SD-card. Because the standard procedure didn't work with Samsung devices, I'm using this snippet of code that I took from a

How to hide folder in sdcard programmatically in android

这一生的挚爱 提交于 2019-12-01 11:10:50
I have an app with xyz.zip folder which is extracting after installation in sdcard. Folder contains a lot of files(e.g Video,audio,etc.).During installing app I wanna hide that folder and hide all items of folder. Thanks in advance. Any answer is appreciated. Use a function like this: public static void hideFile(File file){ File dstFile = new File(file.getParent(), "." + file.getName()); file.renameTo(dstFile); } Please note I did not try the code, but it should at least give you the idea of how to do it. CommonGuy If you want to hide folder in Android or any Linux based system just add . as

Can't write file on SD-card

时光总嘲笑我的痴心妄想 提交于 2019-12-01 11:10:04
问题 I'm trying to write a photo on the SD card without success. I've got the permissions to write in the removable storage and the sd card is mounted. Also, I checked that the path to the SD card exists and I have obtained a positive result. Where it fails is when I use the mkdir() function. It returns false and no file is created. I have tested on both a Samsung A6(Marshmallow) and a Samsung Tab4(Lollipop) This is the snippet of code I'm using to retrieve the path to the SD-card. Because the

how to create virtual sd card in android

╄→尐↘猪︶ㄣ 提交于 2019-12-01 10:56:27
I want to know how to create a virtual SD card in android. I have one SD card in my emulator, but I want to add one more external (virtual) card to my emulator. Can anybody know how to create one more SD card in my emulator? Use the mksdcard function to make a new card- mksdcard -l mySdCard 1024M mySdCardFile.img then use emulator options to specify which card to use- emulator -sdcard mySdCardFile.img 来源: https://stackoverflow.com/questions/9013679/how-to-create-virtual-sd-card-in-android

how to create virtual sd card in android

戏子无情 提交于 2019-12-01 09:45:55
问题 I want to know how to create a virtual SD card in android. I have one SD card in my emulator, but I want to add one more external (virtual) card to my emulator. Can anybody know how to create one more SD card in my emulator? 回答1: Use the mksdcard function to make a new card- mksdcard -l mySdCard 1024M mySdCardFile.img then use emulator options to specify which card to use- emulator -sdcard mySdCardFile.img 来源: https://stackoverflow.com/questions/9013679/how-to-create-virtual-sd-card-in

Share image from SD Card

谁说我不能喝 提交于 2019-12-01 07:26:17
问题 I'm trying for 2 weeks to find how to share images which are stored on an SD card with no success. This answer doesn't work to me, nor is it what I'm looking for. I'm working with Cam Preview app that stores images to SD and then display them in in-app gallery: public class GalleryView extends Activity { private static final int SELECT_PICTURE = 1; private String selectedImagePath; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R

java.Lang.RuntimeException, setParameters failed in android(4.1.1) version

心已入冬 提交于 2019-12-01 06:25:10
I have developed an application which captures a photo when punch in at the time. It's working good on Acer tab(capturing image and saves in sdcard). Now when I run the same application in Samsung Galaxy(Android-4.1.1) My app is getting 'Unfortunately app has stopped' when click on punch in. and my code is here goes.. // ClockIn functionality clockin_btn.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { clockin_btn.setEnabled(false); camera.stopPreview(); capturePhoto(0); // showing one error here in log cat previewing = false; clockin_label.setText(String.format

java.Lang.RuntimeException, setParameters failed in android(4.1.1) version

假装没事ソ 提交于 2019-12-01 04:46:02
问题 I have developed an application which captures a photo when punch in at the time. It's working good on Acer tab(capturing image and saves in sdcard). Now when I run the same application in Samsung Galaxy(Android-4.1.1) My app is getting 'Unfortunately app has stopped' when click on punch in. and my code is here goes.. // ClockIn functionality clockin_btn.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { clockin_btn.setEnabled(false); camera.stopPreview();