2017-01-04 2 views

답변

1

먼저 코드 아래에서이 용도로 오디오 파일을 장치 메모리에서 가져옵니다.

public ArrayList<HashMap<String, String>> getPlayList(){ 
    File home = new File(MEDIA_PATH); 

    if (home.listFiles(new FileExtensionFilter()).length > 0) { 
     for (File file : home.listFiles(new FileExtensionFilter())) { 
      HashMap<String, String> song = new HashMap<String, String>(); 
      song.put("songTitle", file.getName().substring(0, (file.getName().length() - 4))); 
      song.put("songPath", file.getPath()); 

      // Adding each song to SongList 
      songsList.add(song); 
     } 
    } 
    // return songs list array 
    return songsList; 
    } 

그런 다음 플레이어 어댑터에서이 배열 목록을 사용한 다음이 어댑터를 비디오 플레이어에서 사용하십시오.

+0

감사합니다. 내 앱에서 작동 할 때 의견을 보내주세요. –

+0

환영 메시지 대기 중 –