android - Add array of URLs to imageview -
i have following code url html file using jsoup , save in array:
element table2 = document.select("table").get(1); (element td : tr.select("td")){ element img = td.select("img").first(); if (img == null){ continue; } string imgrelpath = img.attr("src"); images.add("http://hostname.com"+imgrelpath); } } objimages = images.toarray();
the array has:
http://hostname.com/hobbit/gifs/static/green.gif http://hostname.com/hobbit/gifs/static/green.gif http://hostname.com/hobbit/gifs/static/clear.gif http://hostname.com/hobbit/gifs/static/clear.gif http://hostname.com/hobbit/gifs/static/green.gif http://hostname.com/hobbit/gifs/static/red.gif http://hostname.com/hobbit/gifs/static/green.gif http://hostname.com/hobbit/gifs/static/green.gif http://hostname.com/hobbit/gifs/static/green.gif http://hostname.com/hobbit/gifs/static/green.gif
no need images url , put imageview 1 after other. idea?
thanks in advance.
edit:
i'm calling picasso.with in async task on onpostexecute in mainactivity:
@override protected void onpostexecute(void result) { imageview estados = (imageview) findviewbyid(r.id.estados); picasso.with(mainactivity.this).load("http://salesianoscarmona.com/nuevo/templates/rt_modulus_j15/images/icons/icon-crank.png").into(estados); mprogressdialog.dismiss(); }
i have import in header:
import com.squareup.picasso.picasso;
use universal image loader downloading images asynchronously.
http://github.com/nostra13/android-universal-image-loader
the library has sample code download image.you may refer it.. after downloading library add library project , insert below code @ necessary place
string final_url="www.google.com/....."; imageview image; imageloader imageloader = imageloader.getinstance(); imageloader.init(imageloaderconfiguration.createdefault(context)); displayimageoptions options; = new displayimageoptions.builder() .showimageforemptyuri(r.drawable.ic_empty) .showimageonfail(r.drawable.ic_error) .resetviewbeforeloading(true).cacheondisk(true) .imagescaletype(imagescaletype.exactly) .bitmapconfig(bitmap.config.rgb_565).considerexifparams(true) .cacheinmemory(true) .displayer(new fadeinbitmapdisplayer(300)).build(); imageloader.displayimage(final_url, image);
Comments
Post a Comment