Manipulating imageView android

0

I have an image view on android, would you like to know how I can perform the exchange of this image via code? Thanks

    
asked by anonymous 30.10.2015 / 17:22

1 answer

1

Try this:

ImageView img= (ImageView) findViewById(R.id.image_id);
img.setImageResource(R.drawable.nova_imagem);

Or

 ImageView img= (ImageView) findViewById(R.id.image_id);
Bitmap bitImage = BitmapFactory.decodeResource(this.getResources(), R.drawable.minha_nova_imagem);
    img.setImageBitmap(bImage);

Greetings!

    
30.10.2015 / 17:27