Expiredmind Expiredmind - 1 month ago 6
Android Question

ImageView content loading from to another ImageView

If it possible to write ImageView to another ImageView?

For example:

ImageView image1= (ImageView)findByVie(R.id.image1)
ImageView image2= (ImageView)findByVie(R.id.image2)

Glide.with(context).load(url).into(image1);

image2=image1
// I want to write image from image 1
//to image 2 without loading it again from internet.

Answer

Use this:

ImageView image1 = (ImageView)findViewById(R.id.image1);
ImageView image2 = (ImageView)findViewById(R.id.image2);

Glide.with(context).load(url).into(image1);
image2.setImageDrawable(image1.getDrawable();

However, with the way Glide works, it caches images it has loaded so calling Glide.with(context).load(url).into(image2); again would just load the image from the cache, not from the remote server again.