I got it figured out. Maybe not the best way but here's how to access the audio media in the media store:
private List<String> songs = new ArrayList<String>(); public void updateSongList() { //Lets get the music from the DB so we have metadata Uri media = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; String[] projection = { // The columns we want MediaStore.Audio.Media._ID, // 0 MediaStore.Audio.Media.ARTIST, // 1 MediaStore.Audio.Media.TITLE, // 2 MediaStore.Audio.Media.DATA, // 3 MediaStore.Audio.Media.DISPLAY_NAME,// 4 MediaStore.Audio.Media.DURATION}; // 5 String selection = MediaStore.Audio.Media.IS_MUSIC + " != 0"; cursor = this.managedQuery(media, projection, selection, null, null); while(cursor.moveToNext()){ songs.add(cursor.getString(0) + "||" + cursor.getString(1) + "||" + cursor.getString(2) + "||" + cursor.getString(3) + "||" + cursor.getString(4) + "||" + cursor.getString(5)); } } I'm not really using any listviews or adapters but you could easily hook one up. I just happen to be using a List that will never be touched by the user. Rob On Jul 7, 10:30 pm, Brombomb <bromb...@gmail.com> wrote: > I've been working on media player and I have most of it down. Maybe > I've gone about getting my data the wrong way (would love it if I > could tap into the MediaStore), but I have the files and can play > them. I just can't figure out how to grab the metadata / IDV3 tag > info from it. I don't think I want to use the media scanner becuase > I'm not adding new files. > > To get my song list: > > public void updateSongList() { > File home = new File(MEDIA_PATH); > if (home.listFiles( new Mp3Filter()).length > 0) { > for (File file : home.listFiles( new Mp3Filter())) { > songs.add(file.getName()); > } > } > songsize = songs.size(); > position = rand.nextInt(songsize); > playSong(position); > } > > To play my songs: > > MediaPlayer mp = new MediaPlayer(); > mp.reset(); > String file = songs.get(song); > mp.setDataSource(MEDIA_PATH + file); > mp.prepare(); > > Is there any way to query the MediaStore given only a file. Did I > miss a better way to grab all the music files? Thanks. > > Rob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---