clamp
clamp

Reputation: 34006

android: get imageview in code

how can i get a variable on the imageview that i have defined in a layout.xml in the code?

thanks!

Upvotes: 5

Views: 15467

Answers (1)

Chris Thompson
Chris Thompson

Reputation: 35598

Give the ImageView an id and then use the findViewById() method

 ImageView view = (ImageView)findViewById(R.id.someid);

Note, the findViewById() method has to be called from a Context object (Activity, etc)

Upvotes: 9

Related Questions