how can i get a variable on the imageview that i have d开发者_JAVA百科efined in a layout.xml in the code?
thanks!
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)
精彩评论