Ashwin
Ashwin

Reputation: 31

How to find the song title, artist name in android so that I can display all the attributes separately in my app?

I am trying to create a Media Player app using the MediaPLayer class and all that stuff. I was able to display the song file name in one line. I am finding it difficult to separate the song title, song name, movie name and display it separately in a TextView.

Upvotes: 0

Views: 4777

Answers (1)

MKJParekh
MKJParekh

Reputation: 34291

You needed to search over internet before asking any question.

     String selection = MediaStore.Audio.Media.IS_MUSIC + " != 0";
     String[] projection = { MediaStore.Audio.Media._ID,
             MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media.TITLE,
             MediaStore.Audio.Media.DATA, MediaStore.Audio.Media.DISPLAY_NAME,
             MediaStore.Audio.Media.DURATION};

     cursor = this.managedQuery(
             MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection, selection,null, null);

     private List<String> songs = new ArrayList<String>();

     while(cursor.moveToNext()){
         songs.add(cursor.getString(0) + "||" + cursor.getString(1) + "||" +
                 cursor.getString(2) + "||" + cursor.getString(3) + "||" +
                 cursor.getString(4) + "||" + cursor.getString(5));
     }

Link To See this,and this,and this,and this for custom listview

Upvotes: 1

Related Questions