을 얻는 방법을 썸네일에서 나오는 url 을 사용하여 안드로이드 글라이드

0

질문

로드하는 오디오 축소판에서 url 을 활지

Glide
                .with(this)
                .load("http://api.boleiachain.com/upload/musictest.mp3")
                .apply(options)
                .centerCrop()
                .placeholder(R.drawable.ic_loading)
                .into(civ_image);

가 이

public  Bitmap coverpicture(String path) {

        Bitmap bitmap=null;
        MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
        mediaMetadataRetriever.setDataSource(path, new HashMap<String, String>());
        try {
            final byte[] coverImage = mediaMetadataRetriever.getEmbeddedPicture();
             bitmap= BitmapFactory.decodeByteArray(coverImage, 0, coverImage.length);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return bitmap;

    }

Glide
                .with(this)
                .load(coverpicture("http://api.boleiachain.com/upload/musictest.mp3"))
                .apply(options)
                .centerCrop()
                .placeholder(R.drawable.ic_loading)
                .into(civ_image);

그것은 작동하지만 함께 지연,좋지 않은 연습에 recyclerView 어댑터

android audio url
2021-11-23 03:44:23
1

최고의 응답

1

캐시할 수 있습니다 비트맵 캐시 확인 존재를 호출하기 전에 coverPicture 방법

  ....load(getCoverpicture("http://api.boleiachain.com/upload/musictest.mp3"))



HashMap<String,Bitmap> cache = new HashMap<String,Bitmap>();
public  Bitmap getCoverpicture(String path) {
    if(cache.containsKey(path)){ return cache.get(path);
    }else{
        Bitmap bitmap = coverpicture(path);
        cache.put(path,bitmap);
        return bitmap;
    }
}

그것이 어떤 구문 오류

2021-11-26 11:34:53

다른 언어로

이 페이지는 다른 언어로되어 있습니다

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................