I have a the following code which aims to get the names of the music
artists on the external media that came with my T-Mobile MyTouch3G.
The Music app shows 6 songs which apparently come with the phone -- 2
each from 3 artists (Jennifer Hudson, Sara Bareilles, and Britney
Spears), but my code seems to miss Britney.  Is this a case of Android
"LEAVING BRITNEY ALONE!!!", or am I doing something wrong?

tone

-----
        String[] proj = new String[] {
                        MediaStore.Audio.Artists._ID,
            MediaStore.Audio.Artists.ARTIST
        };

        Cursor cursor = activity.getContentResolver().query(
                        MediaStore.Audio.Artists.EXTERNAL_CONTENT_URI,
                proj,
                "", null,
MediaStore.Audio.Artists.DEFAULT_SORT_ORDER);

        final int nameColumn = cursor.getColumnIndexOrThrow
(MediaStore.Audio.Artists.ARTIST);
        final int artistIdColumn = cursor.getColumnIndexOrThrow
(MediaStore.Audio.Artists._ID);

        String name = null;
        long artistId = ID_UNDEFINED;

        // loop over table
        cursor.moveToFirst();
        while (cursor.moveToNext()) {
                name = cursor.getString(nameColumn);
                artistId = cursor.getLong(artistIdColumn);

                Log.d(TAG, "artist=" + name
                        + " id=" + artistId
                        );

        }

        // clean up cursor
        cursor.close();

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to