Defining functions, variables, and events
Defining public functions, variables, and events that can be used from App Inventor.
@SimpleFunction(description = "Does a thing")
public void FunctionWithoutReturn() {
    // Code to execute here
}@SimpleFunction(description = "Does a thing and returns a result")
public Object FunctionWithReturn() {
    // Code to execute here
    return whateverYouWantToHaveAsAReturnValue;
}private Object someVariableValue;
@DesignerProperty
@SimpleProperty(description="Gets the value")
public Object someVariable(){
    return someVariableValue;
}
@DesignerProperty
@SimpleProperty(description="Sets the value")
public void someVariable(Object newValue){
    someVariableValue = newValue;
}private Object someVariableValue;
@DesignerProperty
@SimpleProperty(description="Gets the value")
public Object someVariable(){
    return someVariableValue;
}
@DesignerProperty()
public void someVariable(Object newValue){
    someVariableValue = newValue;
}private Object someVariableValue;
@SimpleProperty(description="Gets the value")
public Object someVariable(){
    return someVariableValue;
}
@SimpleProperty(description="Sets the value")
public void someVariable(Object newValue){
    someVariableValue = newValue;
}Last updated