gpt4 book ai didi

java - Android Media.insertImage 并从 SD 卡检索图像

转载 作者:行者123 更新时间:2023-12-01 15:27:20 27 4
gpt4 key购买 nike

我正在尝试将位图保存到 SD 卡,并通过使用 Media.insertImage 返回的字符串,稍后创建位图的实例。但重新创建它是行不通的。它正确保存位图,因为我可以在图库应用程序中看到它,但我只是无法正确获取位图路径或其他内容。任何帮助我都会非常感激。这就是我正在做的事情。

            Bitmap image = Bitmap.createBitmap(this.getWidth(), this.getHeight(), Bitmap.Config.RGB_565);
this.draw(new Canvas(image));
String s = Images.Media.insertImage(Mycontext.getContentResolver(), image, "mytitle", null);

我稍后会尝试在上面的 loc = s 的应用程序中重新创建它:

Bitmap bmp = BitmapFactory.decodeFile(loc);

最佳答案

用途:

Images.Media.getBitmap(Mycontext.getContentResolver(), Uri.parse(loc))

关于java - Android Media.insertImage 并从 SD 卡检索图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10000813/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com