我想制作一个包含音频文件列表的 Android 应用程序,其中包含来自每个文件的 ID3 标签的额外信息。
我目前ContentResolver.query
用来获取音频文件。我想要的 ID3 数据不是常见的可查询信息的一部分,所以一旦我得到文件名,我需要自己提取它。
我的问题是如何将额外信息添加到光标?我了解我无法更改游标结构。我可以提前添加更多列并稍后填充数据吗?我是否必须将所有数据克隆到我自己的新数据结构中?
伊泰。
我想制作一个包含音频文件列表的 Android 应用程序,其中包含来自每个文件的 ID3 标签的额外信息。
我目前ContentResolver.query
用来获取音频文件。我想要的 ID3 数据不是常见的可查询信息的一部分,所以一旦我得到文件名,我需要自己提取它。
我的问题是如何将额外信息添加到光标?我了解我无法更改游标结构。我可以提前添加更多列并稍后填充数据吗?我是否必须将所有数据克隆到我自己的新数据结构中?
伊泰。
It sounds like your are reading audio file information from the built-in media database. In that case there is no way you can add this information to the cursor.
But you can get the extra information in your cursor-reading loop and put it and the information from the cursor into an object that will contain both.
If you are looking to use this with a CursorAdapter
to fill a list view, there is no good way to put this information together.
Some possibilities:
Read the ID3 tag info when you bind the view in your adapter - this means you will be doing extra processing in the UI thread which may slow your app down.
Copy the information from the your cursor to your own database along with the ID3 tag information and read it from there the next time around - this means you will have repeating information of a potentially large size.