开发者

How to store image in sdcard at any time

I am developing an application for an image gallery. I am using the share option in my application. The share option function is share image in SDcard, for example particular image I share, that image store in sdcard. When the user clicks the开发者_C百科 share button that time image will store in SDcard, images are retrieved from a url. Have any idea, anbody knows please give code for anytime can store image in sdcard.

Thanks All


 ContentValues values = new ContentValues(3); 
ContentValues values = new ContentValues(3);
values.put(Media.DISPLAY_NAME, "Bs_image"+tit+".PNG");
values.put(Media.MIME_TYPE, "image/png");               
Uri uri = getContentResolver().insert(Media.EXTERNAL_CONTENT_URI, values);
 OutputStream outStream = getContentResolver().openOutputStream(uri);
bm.compress(Bitmap.CompressFormat.PNG, 100, outStream);
outStream.close();

It is work fine..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜