To set an image in ImageView I did the following using setImageDrawable
:
imagem.setImageDrawable(ContextCompat.getDrawable(this,R.drawable.cliente));
When searching ImageView, I also found the setImageResource
method and it also worked like this:
imagem.setImageResource(R.drawable.cliente);
But I did not find out the difference between the methods and what should I use in that situation, depending on an information from another activity the method arrow the corresponding image.