I am attempting to replace 9 property blocks with one helper block with all the values.
current property blocks
//tops
@SimpleProperty("Top Left")
public String TopLeft() {
return "51";
}
@SimpleProperty("Top Middle")
public String TopMiddle() {
return "49";
}
@SimpleProperty("Top Right")
public String TopRight() {
return "53";
}
//centres
@SimpleProperty("Centre Left")
public String CentreLeft() {
return "19";
}
@SimpleProperty("Centre Middle")
public String CentreMiddle() {
return "17";
}
@SimpleProperty("Centre Right")
public String CentreRight() {
return "21";
}
//bottoms ;)
@SimpleProperty("Bottom Left")
public String BottomLeft() {
return "83";
}
@SimpleProperty("Bottom Middle")
public String BottomMiddle() {
return "81";
}
@SimpleProperty("Bottom Right")
public String BottomRight() {
return "85";
}
I have been following Beka's "how to" here and appear to have successfully created and placed the helper blocks java file:
helper blocks java
package uk.co.metricrat.overlayer.helpers;
import com.google.appinventor.components.common.OptionList;
import gnu.math.*;
import com.google.appinventor.components.common.Default;
import java.util.HashMap;
import java.util.Map;
public enum PositionUnits implements OptionList<String> {
TopLeft("51"),
TopMiddle("49"),
TopRight("53"),
CentreLeft("19"),
@Default
CentreMiddle("17"),
CentreRight("21"),
BottomLeft("83"),
BottomMiddle("81"),
BottomRight("85");
private String positionUnits;
PositionUnits(String val) {
this.positionUnits = val;
}
public String toUnderlyingValue() {
return positionUnits;
}
private static final Map<String, PositionUnits> lookup = new HashMap<>();
static {
for (PositionUnits val : PositionUnits.values()) {
lookup.put(val.toUnderlyingValue(), val);
}
}
public static PositionUnits fromUnderlyingValue(String val) {
return lookup.get(val);
}
}
I have setup a property getter and setter in my main java as she indicates, but this is where I get stuck:
As you can see I have a "red" error in each property.
Questions:
-
What do I need to do in order to return the helper block correctly?
-
Do I have to have a setter/getter or can I just return the helper block?

-
Perhaps more importantly all the values in my OptionsList should be integers and not strings ?
[EDIT] I have now seen that I use OptionList. Converted everything in the helper java, but now have two red errors there!






