Skip to content

Instantly share code, notes, and snippets.

@pavi2410
Last active August 6, 2021 19:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pavi2410/c58954d86e8510e7300b1253c5ecca4a to your computer and use it in GitHub Desktop.
Save pavi2410/c58954d86e8510e7300b1253c5ecca4a to your computer and use it in GitHub Desktop.
Create an extension for Kodular
package io.kodular; // package of the extension will be "com.kodular.SimpleMaths"
// Only these imports are required to interact with Kodular
import com.google.appinventor.components.annotations.*;
import com.google.appinventor.components.runtime.*;
import com.google.appinventor.components.common.*;
@DesignerComponent(version = 1, // Update version here, You must do for each new release to upgrade your extension
description = "Simple Maths extension created by you",
category = ComponentCategory.EXTENSION,
nonVisible = true,
iconName = "images/extension.png") // Change your extension's icon from here; can be a direct url
@SimpleObject(external = true)
public class SimpleMaths extends AndroidNonvisibleComponent {
public SimpleMaths(ComponentContainer container) {
super(container.$form());
}
@SimpleFunction(description = "Simple addition of two numbers")
public int Add(int a, int b) {
return a + b;
}
@SimpleFunction(description = "Simple subtraction of two numbers")
public int Subtract(int a, int b) {
return a - b;
}
}
@pavi2410
Copy link
Author

Thanks @nathan5226 for reminding us to rename Makeroid to Kodular.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment