将图像从URL加载到imageView以及Cache

pat*_*tel 4 android caching imageview

嗨,我是android的新手.我想从URL中插入imageView中的图像,但每当有一次从imageView中的URL加载它时,第二次它应该插入没有互联网意味着它也将存储在缓存中.

Sam*_*Sam 9

为此您可以使用毕加索库您可以从Picasso Library站点下载它,只需将此jar文件放入libs文件夹即可.它将管理Image的所有属性. http://square.github.io/picasso/

String imgURL = "Your URL";
ivmage = (ImageView) findViewById(R.id.imageView1);
Picasso.with(MainActivity.this).load(imgURL).into(ivmage);
Run Code Online (Sandbox Code Playgroud)