Hi,
Is it possible to assign a value to a variable name of which is stored in a string. Following is my scenario.
In main activity i have a few global variables in Type, e.g.,
Now I have created another Activity and called it "actSettings" where I have added Views programatically and set their Tag values to the same variables names, e.g.,
Added a Spinner and set its tag value to NumPlayersPerRound
Added a CheckBox and set its tag value to PlaySound
added an EditBox and set its tag value to CourseCondition
Question:
In my actSettings when users change any value, i want to change the values in my Main activity using the variable names in respective Tag values.
I looked into Reflector Lib but have no understanding of it and Java therfore am not sure how to do it.
Pls help as I think it can be done. If i am able to do it this way then my code becomes very small and clean else will have to writh tons of code as i have only given you an example of three variables whereas i have at least 25 of them in my actual code.
Thanks in advance.
regards.
Is it possible to assign a value to a variable name of which is stored in a string. Following is my scenario.
In main activity i have a few global variables in Type, e.g.,
B4X:
Type MyParameters(NumPlayersPerRound as int, PlaySound as Boolean, _
CourseCondition as string)
Dim tMyP as MyParameters
tMyP.NumPlayersPerRound=6
tMyP.PlaySound=True
tMyP.CourseCondition="Good"
Now I have created another Activity and called it "actSettings" where I have added Views programatically and set their Tag values to the same variables names, e.g.,
Added a Spinner and set its tag value to NumPlayersPerRound
Added a CheckBox and set its tag value to PlaySound
added an EditBox and set its tag value to CourseCondition
Question:
In my actSettings when users change any value, i want to change the values in my Main activity using the variable names in respective Tag values.
I looked into Reflector Lib but have no understanding of it and Java therfore am not sure how to do it.
Pls help as I think it can be done. If i am able to do it this way then my code becomes very small and clean else will have to writh tons of code as i have only given you an example of three variables whereas i have at least 25 of them in my actual code.
Thanks in advance.
regards.