android-sdcard

How unmount programmatically USB DRIVE in Android 4.2

一世执手 提交于 2019-12-08 13:31:33
问题 I have read many posts on this topic, but I have not found a solution yet. In my application I need to unmount the USB DRIVE after copying files from USB DRIVE to the tablet, so I can safely remove it without using the Settings menu. Right now I am using this method: Utility.copyDirectory(file,new File(_CURR_FOLDER)); Process su; su = Runtime.getRuntime().exec("/system/bin/su"); String cmd = "umount" + " " + SDPath + "\n" + "exit\n"; su.getOutputStream().write(cmd.getBytes()); What I get in

Android 4.4 - create application dir on secondary sd card

别来无恙 提交于 2019-12-08 13:14:25
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 idea how to do this??? Simple file.mkdirs(), even with the correct application related path, doesn’t

How to access files in Emulator SD Card using File Explorer?

允我心安 提交于 2019-12-08 11:59:02
问题 I have written a file "myData.txt" to the emulator SD card, and I can find it in mnt/sdcard/download using file explorer. Is there a way to check if I have written correctly to the file without reading it again in my Android program? How about images? What can I do to view the images written in an SD card? 回答1: If you're using Eclipse with ADT : In DDMS, on the "File Explorer" tab, there is a toolbar. There are 2 buttons on the left: arrow with disk (pull from device), and arrow with phone

how to find external sdcard(mnt/exdsdcard) path android? [duplicate]

别来无恙 提交于 2019-12-08 09:12:54
问题 This question already has answers here : Find location of a removable SD card (22 answers) Closed 6 years ago . Exdsdcard path find i need to find out external sdcard path(mnt/exdsdcard).i want to same some images to exdsdcard and i went access database also. 回答1: try this File extStore = Environment.getExternalStorageDirectory(); Then specify the foldername and file name for e.g: "/LazyList/"+serialno.get(position).trim()+".jpg" 来源: https://stackoverflow.com/questions/14765441/how-to-find

android SQLite database with databse on specific location possible?

↘锁芯ラ 提交于 2019-12-07 22:37:51
问题 I am working on an APP which require database, I have created database and it accepts the query, creates the database, and I am able to do all operations. following is the database which works: import java.util.ArrayList; import java.util.List; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; public class DatabaseHandler extends SQLiteOpenHelper

IOException is thrown when SDCard is full

点点圈 提交于 2019-12-07 19:37:32
问题 I am downloading files and saving them to SDCard and want to capture a event when SDCard is full. Right now it throws IOException if no memory is left on SDCard. How to distinguish the memory full exception then the other IOExceptions? Cheers, Prateek 回答1: If you know how much data you are writing to the SD card, you could check whether there is sufficient space before you try to write and thus avoid the IOException altogether. 回答2: If there is no such thing like NoMemoryLeftExeption then

Copy a text file on SD card at the time of application installation?

天大地大妈咪最大 提交于 2019-12-07 12:53:24
问题 I am working on an android game. I want to copy a text file to external SD card when the user installs the game for the first time. The text file is important for properly running the game. How can I do that? Where should i place the text file in eclipse source project so that when i build the apk file, my text file also gets bundled in it and when a use installs application from that apk file the text file gets copied to "SDcard\data" folder.? What code should i write and where, so that it

Recommended path for caching images on external memory / sd card

泄露秘密 提交于 2019-12-07 12:35:27
问题 When I look at my sd card root directory in Android file transfer or Astro file manager it's a mess because apps are storing files all over the place. As developers we follow best practice by caching images/files etc to make our apps quicker and we use Environment.getExternalStorageDirectory() to get the root of the external storage (not hardcoding /sdcard). But what should go next? ideal world we'd follow a convention for dumping our cached files on the open field that is the external

Open file securely with an external Android application without copying the file onto the external storage

别说谁变了你拦得住时间么 提交于 2019-12-07 12:27:32
问题 I'm doing a secure application, where an user can browse some file and open them with application presents on the phone. So for now, my application is really secure, files are well encrypted, but I have one MAJOR break. Indeed, I'm using my application to open the user secure files which are of different types (pdf, doc, txt, jpg, ...) so I'm using the external application presents on the user phone to open them. But my issue is here, because to let another application to open these files, I

Trying to Copy SQLite DB from data to SD card

我只是一个虾纸丫 提交于 2019-12-07 12:03:43
问题 I am using the following code that was posted somewhere on Stack Overflow and modified for my purposes: try { File sd = Environment.getExternalStorageDirectory(); File data = Environment.getDataDirectory(); if (sd.canWrite()) { String currentDBPath = "//data//"+ "com.exercise.AndroidSQLite" +"//databases//"+"MY_DATABASE"; String backupDBPath = "/temp/MY_DATABASE"; File currentDB = new File(data, currentDBPath); File backupDB = new File(sd, backupDBPath); FileChannel src = new FileInputStream