开发者

How to store image in sdcard at any time

开发者 https://www.devze.com 2023-01-16 15:54 出处:网络
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

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

精彩评论

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