Finding songs on your device

Yesterday I implemented functionality to retrieve list of songs from users device. It’s based on two components:

  • Content resolver for making a query to find out some info about our songs
  • Cursor for iterating through columns filled with out desirable info about songs

Why do we need Content Resolver? Can’t we just ask Content Provider for data? Basically, we don’t know which Content Provider we should ask about this specific data so Content Resolver does it for us. It’s used to pick the right Content Provider based on the URI that we have to provide while making a query.

URI for song query is like:


Making a query on our ContentResolver gives back in result a Cursor – an interface which returns collection of our query songs data. Now we can iterate through it to create and add instance of each song to songs list.

That’s it, we have collected info about our songs!

One thought on “Finding songs on your device

  1. I do not even know how I ended up here, but I believed this put
    up was once good. I don’t realize who you might be however definitely
    you’re going to a well-known blogger in the event you are not already.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s