您的位置:首页 > 移动开发 > Android开发

Android保存图片到相册

2016-06-12 21:20 579 查看
private static Uri imgPath=null;

public static void saveImage(byte[] bytes,int len)
{
Bitmap bmp = BitmapFactory.decodeByteArray(bytes,0,len);
String path= MediaStore.Images.Media.insertImage(UnityPlayer.currentActivity.getApplicationContext().getContentResolver(), bmp, "screenshot", "");
imgPath =Uri.parse("file://" + Environment.getExternalStorageDirectory() + path);
UnityPlayer.currentActivity.getApplicationContext().sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,imgPath));
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android