简体   繁体   English

Android获取整个文件系统上的所有媒体文件(SD卡+内部存储器)

[英]Android get all media files on the whole filesystem (SD card + internal stroage)

I want to get the list of all the media files in the whole filesystem ie from the external as well as internal storage. 我想获取整个文件系统中所有媒体文件的列表,即从外部以及内部存储。 How can we do it? 我们该怎么做? Can content providers be used to scan internal storage media? 内容提供商可以用来扫描内部存储媒体吗? Or scannning through the whole file system for the desired extension like ".mp3" is good enough? 还是在整个文件系统中扫描所需的扩展名(例如“ .mp3”)就足够了?

If you are only interested in audio media then you need the following content providers: 如果您仅对音频媒体感兴趣,则需要以下内容提供者:

MediaStore.Audio.Media.INTERNAL_CONTENT_URI MediaStore.Audio.Media.EXTERNAL_CONTENT_URI MediaStore.Audio.Media.INTERNAL_CONTENT_URI MediaStore.Audio.Media.EXTERNAL_CONTENT_URI

Android is scanning automatically the files and keeping content providers for audio, pictures and video (and the generic files) up to date. Android会自动扫描文件,并使内容提供商的音频,图片和视频(以及通用文件)保持最新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM