I use the "imgUrl" to save the URL where I download the image and "BitmapFactory" to zoom out and not waste RAM, but it takes a lot because there are several pictures, Do you know a better way?.
public class DownloadImage extends AsyncTask<Object, Void, Bitmap> {
ImageView imagen;
String imgUrl="";
Bitmap bitm;
protected Bitmap doInBackground(Object... params){
imgUrl = (String) params[0];
imagen = (ImageView) params[1];
try {
URL imageUrl = new URL(imgUrl); /*Using the URL for download the image*/
HttpURLConnection conn = (HttpURLConnection) imageUrl.openConnection();
conn.connect();
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 3;
bitm = BitmapFactory.decodeStream(conn.getInputStream(), new Rect(0, 0, 0, 0), options);
} catch (IOException e) {
Log.e("catch", e+"");
}
return bitm;
}
protected void onPostExecute(Bitmap result){
imagen.setImageBitmap(result);
super.onPostExecute(result);
}
}