Android 从数据库读取音乐路径并播放

Android 从数据库读取音乐路径并播放,android,mysql,database,Android,Mysql,Database,基本上我需要一个音频播放器,可以读取数据库的路径,并加载它 如何从该链接中读取该歌曲?我假设您的数据库有三列-1。id为id2。歌曲名称为Song\u name3。歌曲路径为path 步骤1:查询数据库以获取您想要播放的歌曲的路径 Cursor c = yourDBHelper.query(TABLE_NAME, new String[] {"path"}, new String[] {"song_name=?"}, new String[] {"<son

基本上我需要一个音频播放器,可以读取数据库的路径,并加载它
如何从该链接中读取该歌曲?

我假设您的数据库有三列-
1。id为
id

2。歌曲名称为
Song\u name

3。歌曲路径为
path

步骤1:查询数据库以获取您想要播放的歌曲的路径

Cursor c = yourDBHelper.query(TABLE_NAME, new String[] {"path"}, 
                new String[] {"song_name=?"}, new String[] {"<song_name>"},  
                                             null, null, null);
if(c.moveToFirst()) path = c.getString(0); // This should give the path if the 
                                              query was executed with no errors
第三步:欣赏音乐

mediaPlayer.start();
有关与数据库相关的帮助-
有关MediaPlayer帮助-

还有,我不明白你在这里的意思-

如何从链接中阅读那首歌

mediaPlayer.start();