I'm a total beginner to Java and I'm having what feels like a really simple problem, but I can't find a solution anywhere on the internet. I'm not sure if I'm just being dumb or something.
I have an activity, in the .xml;
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src= XXX />
Where I have the XXX I would like to be a variable. I've tried replacing it with "${Head}" as well as Head, with the following in the .java code for the same activity;
String Head = "@drawable/headsquare";
When I try to build with "${Head}", I get an error message saying Error:(26, 20) String types not allowed (at 'src' with value '${head}').
I eventually want multiple images that are variables that I can easily change depending on other things going on elsewhere in the program.
Thanks for any help.