我得到了模拟路径,但没有真正的路径
你好,社区 我是 Stackoverflow 的新手,但很多时候我用它来寻找问题的解决方案(通常是在 Delphi 中)。今天我是 Android Studio 的新人。我尝试使用此代码在 Android 设备中获取列表文件,从这里: 如何列出 android 目录中的文件?
String path = Environment.getExternalStorageDirectory().toString()+"/Pictures";
Log.d("Files", "Path: " + path);
File directory = new File(path);
File[] files = directory.listFiles();
Log.d("Files", "Size: "+ files.length);
for (int i = 0; i < files.length; i++)
{
Log.d("Files", "FileName:" + files[i].getName());
}
显然,它有效,但我只从 /storage/emulated/0/Pictures 获取缩略图文件 但在设备的真实文件夹(MainStorage/Pictures)中有一些图像文件。我使用应用程序“文件管理器+”找到了这条路径。我不是指分散在不同文件夹中的图像集合。 整个设备中不再有名为“图片”的文件夹。 我知道我可能做错了一些基本的事情,但我对 Android 的缺乏经验使我无法发现它是什么。 该设备可在 Android 11 上运行,但该项目的最低要求是 Android 6
提前,非常感谢。
hello, community
I'm new in Stackoverflow, but many times I used it to find solutions to my questions (usually in Delphi). Today I'm new in Android Studio. I try to get the list files in an Android device using this code, from here: How to list files in an android directory?
String path = Environment.getExternalStorageDirectory().toString()+"/Pictures";
Log.d("Files", "Path: " + path);
File directory = new File(path);
File[] files = directory.listFiles();
Log.d("Files", "Size: "+ files.length);
for (int i = 0; i < files.length; i++)
{
Log.d("Files", "FileName:" + files[i].getName());
}
Apparently, it works, but I get only a Thumbnails file from /storage/emulated/0/Pictures
but in the real folder from the device (MainStorage/Pictures) there are some Image files. I found this path using the App "File Manager +". I don't refer to a collection of images scattered in different folders.
There are no more folders named 'Pictures' in the whole device.
I know probably I do some basic things wrong but my inexperience in Android prevents me from discovering what it is.
The device works in Android 11, but the minimum requirements for the project are Android 6
In advance, thank you very much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论