我需要将照片保存在图库中。
如果我的照片放在SD卡上,则下面的代码会有所帮助。但是,如果我没有sdcard怎么办?只有字节还是临时文件?
MediaStore.Images.Media.insertImage(getContentResolver(), src, title , description);
最佳答案
请尝试以下代码:
FileOutputStream ostream = new FileOutputStream(file);
bitmap.compress(CompressFormat.JPEG, 90, ostream);
ostream.flush();
ostream.close();
String url = Images.Media.insertImage(getContentResolver(), bitmap, "title", null);
关于android - Android-如何在图库中保存照片,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14558954/