在sqlite数据库中写入二进制数据Android的ContentResolver

发布于 2024-10-02 20:43:17 字数 347 浏览 4 评论 0原文

我正在阅读一些Android的源代码,我读到了这个:

OutputStream thumbOut = mCr.openOutputStream(uri);
bitmap.compress(Bitmap.CompressFormat.JPEG, 85, thumbOut);
thumbOut.close();

当尝试在数据库中存储位图(bitmap)时(uri是数据库中一行的URI)。据我所知,openOutputStream允许在数据库中存储二进制数据,但只有文件的路径被放置在数据库中。该文件放置在文件系统中的某个位置。这是正确的吗?我的问题是:以这种方式存储时如何指定文件的确切位置? 感谢您的任何澄清。

I'm reading some sources for Android, and I read this:

OutputStream thumbOut = mCr.openOutputStream(uri);
bitmap.compress(Bitmap.CompressFormat.JPEG, 85, thumbOut);
thumbOut.close();

when trying to store a bitmap (bitmap) in a database (uri is the URI of a row in the database). As far as I can understand, openOutputStream allows to store binary data in the database, but only the path of the file is placed in the DB. The file is placed somewhere in the filesystem. Is this correct? My question is: how do I specify the exact location of the files when stored this way?
Thanks for any clarification.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最偏执的依靠 2024-10-09 20:43:17

我想这个问题的正确答案是使用的路径是已经插入数据库中的路径。

I suppose the correct answer to this question was that the used path is the one already inserted in the database.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文