Reputation: 219
i want load about 50 image into listview
this is my code for load image from url
class ImageDownloader extends AsyncTask<String, Void, Bitmap> {
ImageView bmImage;
public ImageDownloader(ImageView bmImage) {
this.bmImage = bmImage;
}
protected Bitmap doInBackground(String... urls) {
String url = urls[0];
Bitmap mIcon = null;
try {
InputStream in = new java.net.URL(url).openStream();
mIcon = BitmapFactory.decodeStream(in);
} catch (Exception e) {
Log.e("Error", e.getMessage());
}
return mIcon;
}
protected void onPostExecute(Bitmap result) {
bmImage.setImageBitmap(result);
}
}
but image load slow.
and I try use Picasso library, but loading speed slow too
how a better solution to load lot of image from url faster.
sorry for my bad English
thank you for reading
Upvotes: 0
Views: 6096
Reputation: 234
you should try UrlImageViewHelper module , download the jar from https://github.com/koush/UrlImageViewHelper , add it to your android project . then a simple command ImageView imgView = (ImageView) findViewById(R.id.someImage); UrlImageViewHelper.setUrlDrawable(imgView,your uri); also works with list adapters when views are reused.
Upvotes: 1
Reputation: 240
You could try to add this to your android manifest
<application android:hardwareAccelerated="true" ...>
i use this to load videos faster, and it works for me ;) Maybe it'll also work for you
Upvotes: 2