Prerequisites
- A working Android quickstart
- An active effect package that declares runtime parameters
- Java 11 or later for local-variable type inference in the inspection example
Read the authored controls
Query parameters only after package application succeeds:
var parameters = NosmaiEffects.getEffectParameters();
for (var parameter : parameters) {
Log.d("EffectControls",
parameter.name + " (" + parameter.type + ")");
}
Metadata includes the authored name and type, current and default values, optional display text, range information, and option values. Do not copy a parameter name from another package.
Update a value
Replace each placeholder with a name returned by getEffectParameters:
boolean updated = NosmaiEffects.setEffectParameter(
"AUTHORED_PARAMETER_NAME", 0.5f);
boolean textUpdated = NosmaiEffects.setEffectParameter(
"AUTHORED_TEXT_PARAMETER_NAME", "Hello");
Clamp numeric input to the declared range. Integer and Boolean controls accept the numeric overload; string controls require the string overload.
Verify the update
Read a numeric value with NosmaiEffects.getEffectParameterValue(parameterName). A missing value returns Float.NaN; a rejected update returns false. The preview should update without reapplying the package.
Common errors
| Symptom | Cause | Fix |
|---|---|---|
| The parameter list is empty | No compatible package is active, or the active package declares no controls | Apply the package successfully before querying |
The setter returns false | The authored name or type does not match the chosen overload | Use the exact returned metadata and matching setter |
| UI values do not match the package | The app hard-coded a global range | Read and enforce the active parameter's range and options |