sd-card

Append (add) String data to an SD Card text file in an Android application

China☆狼群 提交于 2019-12-06 05:53:01
Just a quick point here. Although my code seems to be okay storing String data etc. in a new file using the standard techniques of writing to a mytext.txt file in an internal or external (SD Card) storage, it is of more use to me for my App to add more data to the same file in the same directory by repeating allowing the user to repeat the process (e.g. a user input and button save) or closing the App and starting over again, so the data permanently remains unless the user chooses to manually delete that data. Using conditional statements to check if the file or directory exists appears to

Arduinio sd on Ethernet shield not working at all

落花浮王杯 提交于 2019-12-06 05:28:17
I am new to Arduino, and I have an ethernet shield with an SD socket on top, but it not seems to be working. I am just trying to run a simple sketch taken from the SD libraries example to get infos about the card, but the "card.init(SPI_HALF_SPEED, chipSelect)" part always fails. I have set the ChipSelect pin to 4, and set pin 10 to output, still nothing. My code: #include <SD.h> Sd2Card card; SdVolume volume; SdFile root; const int chipSelect = 4; void setup() { Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only } Serial.print("\nInitializing

Save Bitmap image to SD card - problem in API 1.5?

孤街醉人 提交于 2019-12-06 04:58:55
Any idea why this is not working on a HTC Hero running on Android API 1.5 ? private static void Save_to_SD (Bitmap bm, String image_name){ String extStorageDirectory = Environment.getExternalStorageDirectory().toString(); String meteoDirectory_path = extStorageDirectory + "/Weather_Belgium"; OutputStream outStream = null; File file = new File(meteoDirectory_path, "/"+ image_name); try { outStream = new FileOutputStream(file); bm.compress(Bitmap.CompressFormat.PNG, 100, outStream); outStream.flush(); outStream.close(); Log.i("Hub", "OK, Image Saved to SD"); Log.i("Hub", "height = "+ bm

preventing a crash when someone mounts an Android SD card

杀马特。学长 韩版系。学妹 提交于 2019-12-06 04:37:37
问题 I have a file open on the SD card. When someone mounts the SD card, it winds up crashing my application. I am trying to register for the ACTION_MEDIA_EJECT broadcast event, and i receive that, but it seems like i'm getting that too late. By the time I get that, it's already crashed my application. Is there any way to get notified before crashing my application? Added some very simple sample code. When I do this, it winds up crashing the service when I turn on USB (MSC mode). Test.java /**

Failed to push selection: Read-only file system : while moving to SdCard

拜拜、爱过 提交于 2019-12-06 03:02:02
I have created a SDCard from my music player app. But when i add songs to the app it is showing error that [2013-01-23 16:09:18 - ddms] transfer error: Read-only file system [2013-01-23 16:09:18] Failed to push selection: Read-only file system I have set uses-permission in my Manifest <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> What might be wrong. Please help me out this issue. Go to sdk/platform-tools directory (to get access to the adb shell) then I typed the following commands: ./adb shell su mount -o rw,remount rootfs / chmod 777 /mnt/sdcard Then it works

Reading and Writing XML file

南楼画角 提交于 2019-12-06 01:59:35
问题 I have an Application in which first I want to create a backup of message from inbox and store it into backup.xml file which is stored at SDCARD/MYBACKUP/mybackup.xml Now I want to retrieve data, stored on SDCARD/MYBACKUP/mybackup.xml and display all messages in listview. 回答1: For Writing XML file to sdcard see this answeer Qberticus's Answer android Reading file is just simple you have to use Xml parsing See This for XML parsing To R/W Sdcard You have to give Permission <uses-permission

Android saving to external SD card?

萝らか妹 提交于 2019-12-06 01:49:51
Hey guys can someone tell me why i cannot save this file to the external sd? Can you check over my code? public void Download() { try { //this is the file you want to download from the remote server String path ="http://mozilla.cdn.leaseweb.com/firefox/releases/4.0.1/win32/en-US/Firefox%20Setup%204.0.1.exe"; //this is the name of the local file you will create String targetFileName; boolean eof = false; URL u = new URL(path); HttpURLConnection c = (HttpURLConnection) u.openConnection(); c.setRequestMethod("GET"); c.setDoOutput(true); c.connect(); //String svto = Environment

android saving to SD card

纵然是瞬间 提交于 2019-12-05 20:21:51
hi to all i have a small problem i have this code to save an image to an SD card public String SDSave( ) { //View arg0 // TODO Auto-generated method stub OutputStream outStream = null; File file = new File( extStorageDirectory , AdName + ".PNG"); try { outStream = new FileOutputStream(file); bm.compress(Bitmap.CompressFormat.PNG, 100, outStream); outStream.flush(); outStream.close(); Toast.makeText(WhereAmI.this, "Saved", Toast.LENGTH_LONG).show(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); Toast.makeText(WhereAmI.this, e.toString(), Toast

Installing android app on sdcard

谁说胖子不能爱 提交于 2019-12-05 18:46:28
I developed an app which can install on sdcard or in mobile internal memory. I used android:installLocation attribute set to "auto" . Now the problem I am facing is when I run app on device then it shows me move to sdcard button enabled but when I uploaded the app to market and installed it from market then move to sdcard button is not enabled. Any Idea where I am lagging. Make sure your app is not copy-protected : The Application Info screen now has either a “move to SD card” or “move to phone” button, but this is often disabled. Copy-protected apps and updates to system apps can’t be moved

If my app's installed on the SD card, is the private data there too?

给你一囗甜甜゛ 提交于 2019-12-05 15:41:15
I am presuming that an app's private data, such as SharedPreferences and SQLite databases, live on the phone's internal storage rather than the SD card, even if the app itself is installed on the SD card. I can't find a simple explicit confirmation of this anywhere. Can someone please confirm? Yes, private data reside in internal storage. I've tested this by exploring file system on rooted device. If app is "installed" on SD card, only APK file is stored on card in some encrypted form. All other app data are in /data/data// folder. 来源: https://stackoverflow.com/questions/7450250/if-my-apps