Assign image by code to ImageView - Android? [duplicate]

0

What parameters this method should take to assign an image of the Drawable folder to the image, or if another method is used for this.

ImageView image;
image.setImageResource("?");
    
asked by Parzival 20.11.2017 в 02:00
source

1 answer

1

You must enter the id of your image.

For example, if your drawable is called "image_test.png" The code would look like this:

image.setImageResource(R.drawable.imagen_test);

I hope I have helped you.

    
answered by 20.11.2017 / 02:56
source