Android Change image depending on a global variable

nafbymnarilla

New Member
the question is simple.I have 2 images in PNG format (logo1.png and logo2.png) in the project. Currently the project is loaded (in a imageview) the logo1.png, but I would do, depending on the value of a variable load the logo1.png or load logo2.png in imageview control.The project currently has 20 Activitys with this picture (each with its own layout in XML), I will not be changing code on the 20 screens, it could do with a simple instruction to verify the value of the variable, but would have to make change in the 20 screens.wonder if there is no way to do that depending on the value of a variable, change the image in the ImageView.will be able to access the value of the variable from the same XML?Thanks in advance.
 
Back
Top