Hi guys,

Am building an application in android studio that should play music from my web site.

Below is the code to add music to the media player. But when I run the app. There is music list created. Kindly help me to load music in the music player.

Thanks in advance.

public void getMusic() {
        Uri  songUri;
        songUri=Uri.parse("https://www.kopalatainment.aidforpcs.com/wp-content/uploads/music");

        Cursor songCursor = contentResolver.query(songUri, null, null, null, null);
        if (songCursor != null && songCursor.moveToFirst()) {
            int songTitle = songCursor.getColumnIndex(String.valueOf(songUri));
            int songArtist = songCursor.getColumnIndex(String.valueOf(songUri));
            int songPath = songCursor.getColumnIndex(String.valueOf(songUri));

            do {
                songsList.add(new SongsList(songCursor.getString(songTitle), songCursor.getString(songArtist), songCursor.getString(songPath)));
            } while (songCursor.moveToNext());
            songCursor.close();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.