Reputation: 34006
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
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