Search code examples
androidandroid-imageview

get ImageView src programmatically


How to get ImageView src programmatically and set it in another ImageView

Drawable drawable = imageViewA....?
imageViewB.setImageDrawable(drawable);

Solution

  • You can do something like this:

    Drawable drawable = imageViewA.getDrawable();
    if(drawable != null){
        imageViewB.setImageDrawable(drawable);
    }