file io - What changes are made in the mass storage API between Android 1.5 and Android 1.6 -


I wrote some code some time ago to save images on the SD card. Now I added the target SDKWerson to my launch and now my file saving code is closed to work

I can reproduce it through my device to remove target SDK version , Because nothing will be written on the SD card on my app.

Is there an API change between Android 1.5 and 1.6 which prevents me from writing to SD card?

  file image directory = new file (environment. Gatestile store's directory () .getAbsolutePath () + file. Separator + FOLDER_NAME); Log D. (ImageSaver.class.getSimpleName (), "SD Card Status:" + Environment .getExternalStorageState ()); If (! ImageDirectory.exists ()) {Boolean created = imageDirectory.mkdir (); Log D. (ImageSaver.class.getSimpleName (), "Created Image Directory" + Image Directory + "" + + Created); } File imageFile = new file (imageDirectory.getAbsolutePath () + file. Separator + name + namefix + FILE_ENDING); Bitmap.compress (bitmap .compress format.png, full_quality, new file-output stream (imagefile));  

This is the test code to compress the bitmap in the SD card. This does not work with the following manifest entry:

  & lt; Use-SDK Android: minSdkVersion = "3" Android: targetSdkVersion = "8" />  

I get the following exception:

09-27 11: 35: 58.689: Error / ImageSaver (8672): File not found 09-27 11 : 35: 58.689: Error / ImageSaver (8672): Java.OfileNoteFoundextension: /sdcard/FOLDER/1285580158662.png

Removing target SDK warsens it again on all platforms .

How do I run the code with the targetSdkVersion set?

You must add permission to your manifest - this API is new since level 4.


Comments