gpt4 book ai didi

android - 在 Android 中保存文件根文件夹

转载 作者:行者123 更新时间:2023-11-29 17:54:56 26 4
gpt4 key购买 nike

所以,在我的应用程序中,我需要在内部存储中保存一个位图,例如在“图片”文件夹中,以便用户以后可以看到它并用它做任何想做的事。

这看起来很简单,但我不知道该怎么做。我找到的每个教程都展示了如何将其保存在外部存储或您应用程序的文件夹中,但没有展示如何将其保存在可供用户使用的普通内部公共(public)存储中。

最佳答案

So, in my app i need to save a Bitmap on the internal storage, in the "Pictures" folder for example, so that the user can see it and do whatever it wants with it later on.

那么你的意思是外部存储。用户无权访问内部存储。

您不妨回顾一下the documentation for the Android definition of internal and external storage .

It seems simple, but i can't find out how to do it

您可以通过 Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) 获取一个可能的目录,并将文件保存在那里。请注意,该目录有可能尚不存在,因此如有必要,请使用 mkdirs() 创建它。

Every tutorial I find shows how to save it in the External Storage or in your app's folder, but none of how to save it on the normal, internal, public storage, avaliable for the user.

外部存储。

关于android - 在 Android 中保存文件根文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20085050/

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