Insert Image into code, SetImage Android, Error making dynamics in java

0
ImageView img = (ImageView) findViewById(R.id.img);
//Atualizando a imagem dinamicamente. A classe R é utilizada para acessar o recurso.
img.setImageResource(R.drawable.img);

There was a mistake, I wanted to know where I was wrong

    
asked by anonymous 08.05.2018 / 04:50

1 answer

0

Please try as follows

SeuContexto.getDrawable(R.drawable.img)
    
08.05.2018 / 14:05