Manipulating android imageView

Asked

Viewed 97 times

0

I have an image view on android, I wonder how can I exchange this image via code ? Thank you

1 answer

1


Try it like 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!

  • worked well friend, taking advantage you know how I can create a folder inside the drawable or something similar to be able to organize better ?

  • Friend, if possible, could you create a new question? For people who come to search, find it more easily ! Thank you!

  • I created it, but no one answered, I’ll get the link

  • http://answall.com/questions/95576/android-studio-criar-diretorios

Browser other questions tagged

You are not signed in. Login or sign up in order to post.