How to assign drawable image to an ImageView by code? [duplicate]

0

I try to assign an image of the drawable folder to an ImageView with the setImageResource method, but I do not know what the method takes to access R.drawable.image_name

ImageView image;
image.setImageResource("?");
    
asked by Schopenhauer 20.11.2017 в 01:56
source

1 answer

0

Try with setImageDrawable

image.setImageDrawable(getResources().getDrawable(R.drawable.image_name));
    
answered by 20.11.2017 в 05:30