Reputation: 1674
I want to make an Android App that includes a list of audio files with extra info from each file's ID3 tag.
I currently use ContentResolver.query
to get the audio files. The ID3 data I want is not part of the common, queryable information, so once I get the filename I'll need to extract it myself.
My question is how to add that extra information to the cursor? I understand that I can't change the cursor structure. Can I add more columns in advance and fill the data later? Do I have to clone all the data to a new data structure of my own?
Itai.
Upvotes: 0
Views: 664
Reputation: 3985
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.
Upvotes: 1