gpt4 book ai didi

android - 显示文件列表

转载 作者:搜寻专家 更新时间:2023-11-01 09:15:13 26 4
gpt4 key购买 nike

我想显示 Android 手机中的文件列表。

例如,我希望我的应用能够列出手机中存储的所有图像,我不想要画廊 View ,只想要一个简单的列表。

我还希望能够显示所有的音频文件

任何帮助将不胜感激

谢谢

最佳答案

我假设您指的是外部存储。继续阅读 Data Storage ,它将告诉您导航文件系统的正确方法。

If you're using API Level 8 or greater, use getExternalFilesDir() to open a File that represents the external storage directory where you should save your files. This method takes a type parameter that specifies the type of subdirectory you want, such as DIRECTORY_MUSIC and DIRECTORY_RINGTONES (pass null to receive the root of your application's file directory). This method will create the appropriate directory if necessary. By specifying the type of directory, you ensure that the Android's media scanner will properly categorize your files in the system (for example, ringtones are identified as ringtones and not music). If the user uninstalls your application, this directory and all its contents will be deleted.

If you're using API Level 7 or lower, use getExternalStorageDirectory(), to open a File representing the root of the external storage.

关于android - 显示文件列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5188376/

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