public void Saveimage2phone (slideshowimage image) {
String ImagePath;
if (Environment.getexternalstoragestate (). Equals (environment.media_mounted)) {
Imagepath= "/sdcard/mixin/image/";
Bitmap Bitmap = ((bitmapdrawable) image.getdrawable ()). Getbitmap ();
Makerootdirectory (ImagePath);
String Name=system.currenttimemillis () + ". jpg";
FileOutputStream Fos=null;
File File=new file (imagepath+name);
try {
File.createnewfile ();
Fos=new fileoutputstream (file);
Bitmap.compress (Bitmap.CompressFormat.JPEG, N, FOS);
Toast.maketext (Mcontext, "Save succeeded", 0). Show ();
Send a broadcast to update a saved picture
Sendbroadcast (New Intent (intent.action_media_mounted, Uri.parse ("file://sdcard/mixin/image/"));
Sendbroadcast (New Intent (Intent.action_media_scanner_scan_file,uri.parse ("file://" +imagepath+name));
} catch (IOException E1) {
TODO auto-generated Catch block
Toast.maketext (Mcontext, "Save Failed", 0). Show ();
E1.printstacktrace ();
}finally{
try {
Fos.flush ();
Fos.close ();
} catch (IOException e) {
TODO auto-generated Catch block
Toast.maketext (Mcontext, "Save Failed", 0). Show ();
E.printstacktrace ();
}
}
}else{
Toast.maketext (Mcontext, "Memory card without detection", 0). Show ();
}
}
public void Makerootdirectory (String filePath) {
File file = null;
try {
File = new file (FilePath);
if (!file.exists ()) {
File.mkdir ();
}
} catch (Exception e) {
}
}
Android Picture copy