sd-card

How can I backup sqlite file in SD Card programmatically?

夙愿已清 提交于 2019-11-29 02:32:55
When you use emulator your sqlite file is stored in a folder near your main application folder and you can download it. But this feature is not accessible in not rooted devices. How can I backup this existing sqlite file in SD Card programmatically ? I want to have a button in my application that stores this file in a special path in my SD Card. Is it possible? Thanks, You can try this, work for me, remember to get the WRITE_EXTERNAL_STORAGE permission in your manifest: // Copy to sdcard for debug use public static void copyDatabase(Context c, String DATABASE_NAME) { String databasePath = c

Eclipse console shows:'Failed to push selection: Read-only file system'when i try to push a file

痴心易碎 提交于 2019-11-28 22:38:22
I am trying to push a file to the SD Card but its showing error in console 'failed to push selection: Read-only file system'.I am using DDMS perspective in Eclipse.I generated sdcard using mksdcard command. Amel Jose Just go to C:\Documents and Settings\<adminstrator>\.android\avd take 'properties' of your avd folder (there is a folder for each of the avd's) uncheck 'Read only' -> OK This was the only thing that worked for me. P.S: Some of these folders might be hidden. On the Terminal or Command-Prompt , write these( for me its command prompt ): adb shell (Opens the device shell. you'll see a

How can I retrieve an SD card's serial number in Android 7.0+?

纵然是瞬间 提交于 2019-11-28 22:29:30
问题 In some versions of Android, and other variants of Linux, it's possible to get the serial number of a mounted SD card, e.g. by reading the contents of /sys/class/mmc_host/mmc0/mmc0:0001/serial or /sys/block/mmcblk0/device/serial (specific numbers may vary). In my testing this has worked pretty reliably, as long as the SD card is inserted in a built-in SD card slot (not mounted via USB adapter). But as of Android 7.0 Nougat, the OS is said to be blocking access to this information, at least on

How to export data to csv file in Android?

被刻印的时光 ゝ 提交于 2019-11-28 22:24:56
问题 I created a csv file with the following format which I'm aiming to output to the device's sd card: Ship Name,Scientist Name,Scientist Email,Sample Volume,Sample Colour,Longitude,Latitude,Material,Date Each of the vales in the csv will be of type string except for the last value of date. The name of the csv file is AnalysisData.csv I've looked examples on Stackoverflow such as this, Export my data on CSV file from app android but this creates a new file which I don't want. I have already added

Display all music on SD card [closed]

旧城冷巷雨未停 提交于 2019-11-28 18:29:28
I'm using code form this page: http://z4android.blogspot.com/2011/06/displaying-list-of-music-files-stored.html The code is working, but not soo good. When I'm trying to scroll down, the ListView keeps repeating the songs in the list. I have been looking for some alternative code, but I have not found any. Thanks for any help. I'm not entirely sure exactly what causes the problems you mention, but try this code. private MediaPlayer mMediaPlayer; private String[] mMusicList; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super

How does storage access change on Android 6?

不问归期 提交于 2019-11-28 16:04:53
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, and use the DocumentFile API instead of the File API. This raied a lot of questions, as I've written

How to Reuse getExternalStorageState?

五迷三道 提交于 2019-11-28 14:27:57
How can this be written in its own class to be used over and over again? And where the comment line "//Loads the List" is, I need to be able to change that at runtime. Thnx ahead of time for the info. /** * -- Check to See if the SD Card is Mounted & Loads the Ordered List * ====================================================================== **/ private void storageState() { if (android.os.Environment.getExternalStorageState().equals( android.os.Environment.MEDIA_MOUNTED)) { orderASC();// Loads the list } else if (android.os.Environment.getExternalStorageState().equals( android.os

Is there a way to tell if the sdcard is mounted vs not installed at all?

百般思念 提交于 2019-11-28 12:46:11
Using the api logic you can detect if the sd card is available for read or write, but it doesn't tell you why it is not writable. I want to know if the user even has a sd card vs if it just mounted. Is this possible? for example: String state = Environment.getExternalStorageState(); if (state.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) { } Check out the possible constants at : http://developer.android.com/reference/android/os/Environment.html#getExternalStorageState%28%29 public static boolean isSdPresent() { return android.os.Environment.getExternalStorageState().equals(android.os

Is it possible to copy database file to SD card?

你。 提交于 2019-11-28 11:08:01
问题 I have a database on my Android phone, and I need to get the information onto an SD card. Is it possible to save the database file onto the SD card in a readable state? I haven't been able to find any information on how to do this. Some source code that copies the database file to an SD card would be ideal. 回答1: The database file is just like any other file, if you make a binary file copy it will work. Java has no built in file copy method, so you can use this: Standard concise way to copy a

How to capture the image and save it in sd card

吃可爱长大的小学妹 提交于 2019-11-28 09:34:00
hey guys i am using the following code to access camera from my application. The application is able to access the camera i have also added a button whose onclicklistener adds this line of code :- camera.takePicture(mShutterCallback, mPictureCallbackRaw, mPictureCallbackJpeg); Now i dont know what happens but the application gets stuck i have to force close it and then i can not even access the native camera application. I think it leaves the application without releasing the Camera object. Plus the image never gets saved. Code :- SurfaceHolder holder; SurfaceView surface; Camera camera;