Android的名单音乐文件夹,并发挥他们 [英] Android list music by folders and play them

查看:201
本文介绍了Android的名单音乐文件夹,并发挥他们的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发的音乐播放器为Android是已经在市场上。 用户被要求添加一个文件夹视图,列出了音乐在他们的智能手机的所有文件夹,我想开发它。

MediaStore已经知道哪些是要遵循正确的路径(因为它需要知道他们重新扫描每个时代的SD卡),所以我在想,如果有一种方式来获得这些路径,并用它们来展示音乐的用户。

另一个选项(但我不喜欢它)来获取这些路径是查询MediaStore为所有的音乐对他们的图书馆和循环得到共同的基础路径。但是,如果用户已经超过1 / 2K音​​乐这将是一个巨大的,而不是优化的方式。

你知道我怎么能解决呢?

我也回想刚刚上市的所有文件夹和文件的SD卡,但我在一些递归遇到的问题,因为我想不显示:

  • 在没有音频文件(用的FileFilter已经完成)
  • 在不显示空文件夹(已完成,但有递归问题)
  • 在不与.nomedia文件显示文件夹(即告诉我,没有任何媒体文件,但递归的问题)。也被别人应用程序创建多个文件夹不要放在.nomedia文件,所以我向他们展示

你怎么看待这件事?

更新:我想要做的是这样的:的 https://play.google.com/store/apps/details?id=cyberniko.musicFolderPlayer 我想告诉那里有一些音乐文件夹,并允许用户开始播放音乐选择文件夹。

解决方案
  

MediaStore已经知道哪些是要遵循正确的路径(因为它需要知道他们重新扫描每个时代的SD卡),所以我在想,如果有一种方式来获得这些路径,并用它们来展示音乐的用户。

MediaStore 扫描所有外部存储,AFAIK,而不仅仅是一些具体的根文件夹。

I'm developing music player for android that is already on the market. Users are asking to add a Folder view to list all folders that has music in their smartphone and I want to develop it.

MediaStore already know which are the correct paths to follow (because it needs to know them to re-scan every times the sdcard) so I was wondering if there is a way to get those paths and use them to show music to the user.

Another options (but I don't like it) to get those paths is to query MediaStore for all the music in the library and loop on them to get the common base paths. But if user have more than 1/2k music it will be a huge and not optimized way.

Do you know how can I solve it?

I was also thingking about listing all folders and files in the sdcard but I'm encountering in some recursive problem because I want to not show:

  • not audio file (already done with a FileFilter)
  • not show empty folders (already done but has the recursive problem)
  • not show folders with .nomedia file (that tells me that there aren't any media files, but has the recursive problem). Also many folders created by others application don't put the .nomedia file, so I've to show them

What do you think about this?

UPDATE: what I want to do is something like this: https://play.google.com/store/apps/details?id=cyberniko.musicFolderPlayer I want to show folders where there are some music and allow the user to start playing music in selected folders.

解决方案

MediaStore already know which are the correct paths to follow (because it needs to know them to re-scan every times the sdcard) so I was wondering if there is a way to get those paths and use them to show music to the user.

MediaStore scans all of external storage, AFAIK, not just some specific root folders.

这篇关于Android的名单音乐文件夹,并发挥他们的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆