简体   繁体   中英

“setImageDrawable(Drawable.createFromPath)” get image from web server Android

I am using the the gridView example from the developer.android.com site. But they are using images saved in the res/drawable folder. I want to try and set the images to come from my web server.

private Integer[] mThumbIds={

        for(int i=0;i<myJSONArray.lenght();i++){
            Object[] myJSONArray;
            setImageDrawable(Drawable.createFromPath(String "www.mywebsite.com: + myJSONArray[i]).thumb);
        };

};

Am I on the correct path to accomplish this? I am looking for advice or documentations/tutorials on this process. Thanks in advance.

I modified the GreenDroid library to do it for me - it has a nice set of imageloading classes. It takes some slight modification if you don't want to use their actionbar (I didn't see an easy way to do it without modification). Everything is also async : D !

这样,您将无法从Internet创建Drawable,因为您首先下载了内容并将其设为Drawable,请参阅

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM