The example in this article describes how Android saves bitmap objects to an SD card. Share to everyone for your reference. as follows:
Bitmap Logobitmap = Bitmapfactory.decoderesource (Mcontext.getresources (), R.drawable.arcnote_logo);
Bytearrayoutputstream Logostream = new Bytearrayoutputstream ();
Boolean res = logobitmap.compress (bitmap.compressformat.png,100,logostream);
Read the image to the Logostream byte[] logobuf = Logostream.tobytearray ();
Save image to byte[] Bitmap temp = Bitmapfactory.decodebytearray (logobuf,0,logobuf.length);
Reads the image from byte[] to generate the bitmap object temp savemybitmap ("tttt", temp);
Save image to sd card public void Savemybitmap (String bitname,bitmap mbitmap) {File f = new File ("/sdcard/" + Bitname + ". png");
try {f.createnewfile ();
The catch (IOException e) {//TODO auto-generated catch block} FileOutputStream fout = null;
try {fout = new FileOutputStream (f);
catch (Exception e) {e.printstacktrace ();
} mbitmap.compress (Bitmap.CompressFormat.PNG, fout);
try {fout.flush ();
catch (IOException e) {e.printstacktrace ();
try {fout.close ();
catch (IOException e) {e.printstacktrace (); }
}
I hope this article will help you with your Android program.