Hello developers
I am developing an extension. I wanted to add dropdown designer property and red block.
I created enum OptionList. So I could create red helper block. But I couldn't create dropdown designer property without editorArgs . Do I have to add editorArgs additionally.
My Property Method:
@DesignerProperty(defaultValue = "", editorType = PropertyTypeConstants.PROPERTY_TYPE_CHOICES)
@SimpleProperty(category = PropertyCategory.BEHAVIOR, description = "sets animation")
public void Animation(@Options(Animation.class) String anim) {
this.animation = anim;
}
Taifun
April 19, 2026, 7:13pm
2
Se this thread for an example
here is an example which I used for my battery manager extension App Inventor Extensions: Battery Manager | Pura Vida Apps
one of the helper classes looks like that (here for the Health helper blocks)
package com.puravidaapps.TaifunBattery.helpers;
import java.util.HashMap;
import java.util.Map;
import com.google.appinventor.components.common.OptionList;
/**
* Defines a Health type
*/
public enum Health implements OptionList<String> {
Cold("cold"),
Dead("dead"),
Good("good"),
Ov…
Taifun
It does not have any designer property.
Taifun
April 19, 2026, 8:14pm
4
Here is another example taken from my alarmmanager extension App Inventor Extensions: Alarm Manager | Pura Vida Apps
/**
* StartMode
*/
@SimpleProperty(category = PropertyCategory.BEHAVIOR, description = "StartMode for alarm time. " +
"Possible values are: 1, 2, 3 or 4. (1 = Only notification, 2 = Start Above Lock Screen or Notification, " +
"3 = Start Always, 4 = Only Background Processing).")
public String StartMode() {
return startMode;
}
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_STRING, defaultValue = "2")
@SimpleProperty
public void StartMode(@Options(StartMode.class) String startMode) {
if ((startMode.equals("1")) || (startMode.equals("2")) || (startMode.equals("3")) || (startMode.equals("4"))) {
this.startMode = startMode;
} else {
this.startMode = "2";
}
}
Taifun
If you want to do a dropdown in the designer side, you need to do the following:
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_CHOICES,
editorArgs = {"Option A", "Option B", "Option C"})
@SimpleProperty
public void MyProperty(String arg) { /* ... */ }
I don't believe there is a means currently of synchronizing the options between the two, but it could probably be done with a patch to App Inventor to auto populate the editorArgs field from the enum entries.
system
Closed
April 27, 2026, 2:04pm
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.