2016-07-06 5 views
-2

기본적으로 데이터베이스에서 경로를 읽고로드 할 수있는 오디오 플레이어가 필요합니다. 그 노래에서 해당 링크를 읽는 방법? 의 경로를 얻기 위해 데이터베이스 쿼리 :
1. 아이디
2. 노래 이름 path데이터베이스에서 음악 경로 읽기 및 재생

1 단계로 노래 song_name
3. 경로로 id로 -

답변

0

나는 당신의 데이터베이스가 세 개의 열을 가지고 가정입니다 노래가 재생하고자하는

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 

2 단계 : 초기화 MediaPlayer를 위의 경로

MediaPlayer mediaPlayer = MediaPlayer.create(context, path); 
01 23,516,

3 단계 : 즐겨 databsase 관련 도움말은 음악

mediaPlayer.start(); 

-https://developer.android.com/training/basics/data-storage/databases.html
MediaPlayer를 도움말 용 - https://developer.android.com/guide/topics/media/mediaplayer.html 또한

, 힘 당신이 여기 무엇을 의미하는지 이해 -

읽는 방법 그 노래에서 그 노래