[Under Evaluation] How do we create an extension for App Inventor?

In this guide I tell how do we create an extension for App Inventor.

Where we create extension for App Inventor?
We create extension for App Inventor on ide.niotron.com , editor.appybuilder.com , Rush • A new and improved way of building extensions

  • To create any extension first we need import

How we import to create a Function blocks(blue block)
import com.google.appinventor.components.annonations.SimpleFunction;
We use this as @SimpleFunction

How we import to create a Property blocks(green block)
import com.google.appinventor.components.annonations.SimpleProperty;
We use this as @SimpleProperty

How we import to create a Event blocks(yellow block)
import com.google.appinventor.components.annonations.SimpleEvent;
We use this as @SimpleEvent

  • We need 1 more import to create Event block
    import com.google.appinventor.components.runtime.EventDispatcher;

  • Now If we want to create a button extension we need import of button, for label extension we need import of label

From where we get import
To get import of button search android button on google open second site whose name was developer.android........ see from top you got android.widget.Button; so this is the import of Button

What is import of Button
import android.widget.Button;

Code of Button
Button button = new Button(context);

  • public void do not return any value but public Object return a value

Data type

void = Do not return anything
Object = Return anything
String = text
int = number
boolean = True or False

Example code

import com.google.appinventor.components.annotations.*;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.annotations.DesignerComponent;
import com.google.appinventor.components.annotations.SimpleObject;
import 
com.google.appinventor.components.annonations.SimpleFunction;
import 
com.google.appinventor.components.annonations.SimpleProperty;
import com.google.appinventor.components.runtime.HVArrangement;
import android.widget.Button;
import android.view.View;
import android.widget.FrameLayout;

private Button button;

@SimpleFunction(description = "Creates a button in the given arrangement")
public void Create(HVArrangement arrangement) {
View view = arrangement.getView();
button = new Button(context);
FrameLayout frameLayout = (FrameLayout) view;
frameLayout.addView(button, new FrameLayout.LayoutParams(-1, -1)
}

@SimpleProperty(description = "Sets the text of button")
public void Text(String text) {
button.setText(text);
}
  • Helpfull
  • Not helpfull

0 voters

If you want to be taken seriously as an tutorial maker or anything you shouldn't ask other people with a poll if they like it. My advise, remove it.

IMHO, this howto is perhaps only 10-20% complete, it is a huge subject, and this howto probably only serves to confuse. I do not recommend this for submission.

@Faraz_Firoz - I suggest you show how you would create a simple extension with a method, property and event from start to finish, using the IDE and builder of your choice, then title it accordingly (e.g. "Howto create an extension for AI2 using the IntelliJ IDE and Rush extension builder")

2 Likes

Same topic I made on Niotron community and they approve my topic and they give me like and vote

These are just the basics ... very general. The topic may not be visible and you can expand it to have more information. Also, your sample code is not an extension code that MIT supports, it lacks a class and a few annotations.

This is not very general topic so many people do not know about this If you all do not want to list this topic then no problem

This is fine for some one with the attention span of a flea, like me.

I don't have time for a full meal, but it is nice to grab a little taste.