android图片进手机相册
android图片入手机相册
想把图片存到手机相册,
网上例子如下:
MediaStore.Images.Media.insertImage(getContentResolver(), bitmap, "qrPic", "");
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://"+ Environment.getExternalStorageDirectory())));
存到手机里的是大小为0的空图片。
------解决方案--------------------
用流把图片写到SD卡,然后调用 Uri uri = Uri.parse("file://" +path);//path为图片的路径
context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri));
那么你在图库里面就能看见呢
想把图片存到手机相册,
网上例子如下:
MediaStore.Images.Media.insertImage(getContentResolver(), bitmap, "qrPic", "");
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://"+ Environment.getExternalStorageDirectory())));
存到手机里的是大小为0的空图片。
------解决方案--------------------
用流把图片写到SD卡,然后调用 Uri uri = Uri.parse("file://" +path);//path为图片的路径
context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri));
那么你在图库里面就能看见呢