gpt4 book ai didi

android - android中的SD卡存储

转载 作者:行者123 更新时间:2023-11-30 02:09:25 25 4
gpt4 key购买 nike

如果已经解释过了,请原谅。

我正在使用文件路径作为 Environment.getExternalStorageDirectory()+"/myfolder/myfile.img用于存储具有 list 权限的文件。它对我来说工作正常。

我对这行代码有一些疑问。

  1. 我注意到这会在内部存储器中创建一个文件夹,那么如果内存空间不足?

  2. 如果外置SD卡内存足够怎么办?

  3. 它会自动在外部存储卡中创建文件夹吗?

提前致谢。

最佳答案

来自这里:http://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirectory()

Return the primary external storage directory. This directory may not currently be accessible if it has been mounted by the user on their computer, has been removed from the device, or some other problem has happened. You can determine its current state with getExternalStorageState().

Note: don't be confused by the word "external" here. This directory can better be thought as media/shared storage. It is a filesystem that can hold a relatively large amount of data and that is shared across all applications (does not enforce permissions). Traditionally this is an SD card, but it may also be implemented as built-in storage in a device that is distinct from the protected internal storage and can be mounted as a filesystem on a computer.

1) 如果你不捕获异常,你的应用就会崩溃
2) 与 1 相同。
3)不!

关于android - android中的SD卡存储,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30328040/

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