Method of obtaining sdcard music file by Android programming
This paper describes the method of obtaining sdcard music files by Android programming. Share with you for your reference, as follows:
Uri: indicates the name of the database to be queried plus the name of the table. We can find the parameters of the corresponding information from mediastore. Please refer to the development documentation for details.
Projection: specify which columns in the query database table, and the returned cursor will include the corresponding information. Null returns all information.
Selection: specify query criteria
Selectionargs: what is in the parameter selection? The symbol is, you can replace the question mark with the actual value. If there is no selection? If so, the string array can be null.
Sortorder: Specifies the sort order of query results
The following command will return the information of all music files on the external memory card:
Song ID: mediastore.audio.media_ ID
Song name: mediastore.audio.media.title
Album name of the song: mediastore.audio.media.album
Singer name of the song: mediastore.audio.media.artist
Path to song file: mediastore.audio.media.data
I hope this article will help you in Android programming.