1. Key Code
Copy Code code as follows:
R.drawable.test is a picture in the current project
Bitmap Bitmap = Bitmapfactory.decoderesource (Getresources (),
R.drawable.test);
FileOutputStream fos = null;
Try
{
File File = new file ("/mnt/sdcard/testfile");
if (!file.exists ())
{
File.mkdir ();
}
FOS = new FileOutputStream ("/mnt/sdcard/testfile/test.jpg");
Bitmap.CompressFormat.PNG
Bitmap.compress (Bitmap.CompressFormat.JPEG, FOS);
catch (FileNotFoundException e)
{
E.printstacktrace ();
}
2. Permission
Copy Code code as follows:
<uses-permission android:name= "Android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name= "Android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
Attached: Recently wrote a small program, is about the image scaling, zooming completed can be generated in the local new pictures, this can only be downloaded in the resources