0
I have a ImageButton and when I click on it wanted the Background of him passing to another ImageButton.
Have View v of the first ImageButton, and imgB6 is the ImageButton that I want to receive the background of v, and gives error in v.getBackground():
findViewById(R.id.imgB6).setBackgroundResource(v.getBackground());
v.getBackground() You’re making a mistake I don’t know why, since it’s a drawable.
v is received per parameter when in the method Onclick, and has a drawable correspondent!
I wanted to pass the Backgound of v(View) for imgB6(ImageButton).
Do you have any code? Put the error in your question.
– viana
Put the xml of the two imageView
– ramaral
sao
ImageButtons, one comes per parameter toViewwhat I callv, and thisViewwant to pick up thebackgroundand put in anotherImageButton imgB6. ThenfindViewById(R.id.imgB6).setBackgroundResource(v.getBackground());– Leandro Almeida
@Leandroalmeida the background is color or image?
– viana