开发者

create drawable from path problem

开发者 https://www.devze.com 2023-02-24 15:08 出处:网络
For some reason d=null when creating a drawable from coverArtURLStr, which is the full http path to the resource on the LAN.

For some reason d=null when creating a drawable from coverArtURLStr, which is the full http path to the resource on the LAN. Anything obvious wrong? It's a path to a .png [I can access the LAN OK, and Data.defaultCoverArt works fine]

public static void updateCoverArt(String coverArtURLStr)
{
    String coverArtURL = coverArtURLStr;
    Drawable d;

    if (coverArtURL.equals(""))
        d = Data.de开发者_Go百科faultCoverArt;
    else           
        d = Drawable.createFromPath(coverArtURL);

    Data.coverArtIV.setImageDrawable(d);
}


I don't think Drawable.createFromPath() method can handle URLs. Try this solution Android Drawable Images from URL.

0

精彩评论

暂无评论...
验证码 换一张
取 消