2016-10-26 2 views

답변

0

나는 당신의 목적은 목록보기에서 해당 노래의 앨범이나 노래 커버 이미지를 표시하는 생각이 직접 다음과 같은 방법 -

MediaMetadataRetriever mmr = new MediaMetadataRetriever(); 
mmr.setDataSource("songPath"); 
byte [] data = mmr.getEmbeddedPicture(); 
if(data != null) 
{ 
Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length); 
// Use this bitmap to add to image view 
} 
else{ 
//This means image is not embedded in the audio file 
//and pick image form other source 
} 
에있는 노래 자체에서 포함 된 사진을 추출하여 수행 할 수 있습니다 당신이 정말로 먼저, 각 노래에 대해 인터넷에서 이미지를 얻고 싶은 경우에 당신이 어떤 찾고 있다면

는 각 노래에 대한 이미지를 해당 목록을 찾은 다음 this-

public Bitmap getBitmapFromURL(String src) { 
try { 
    java.net.URL url = new java.net.URL(src); 
    HttpURLConnection connection = (HttpURLConnection) url 
      .openConnection(); 
    connection.setDoInput(true); 
    connection.connect(); 
    InputStream input = connection.getInputStream(); 
    Bitmap myBitmap = BitmapFactory.decodeStream(input); 
    return myBitmap; 
} catch (IOException e) { 
    e.printStackTrace(); 
    return null; 
} 
} 

각 노래를 다운로드해야 소스를 얻을 수있는 곳 이미지는 노래에 대한 몇 가지 세부 정보를 제공함으로써 사용할 수있는 직접 소스가 없다고 생각합니다.

관련 문제