App Inventor Extension Development | How To Create Green Blocks (Properties) | Developer Vedang

To create properties you want to use @SimpleProperty in your IDE or Code Editor. After that set a description of that block for example @SimpleProperty(description = "description of your propert")

After setting description you want to set that this property returns a String or Int or a boolean. After that set the name of the block. For example - public String MyAwesomeProperty() .


Here Is The Example Code -


@SimpleProperty(description = "this is property")
public String Property(){
// Your Code Here
}


Here Is The Example Code -


import android.content.Context;
import android.util.Log;
import com.google.appinventor.components.annotations.*;
import com.google.appinventor.components.runtime.*;
import com.google.appinventor.components.common.ComponentCategory;

@DesignerComponent(version = 1,  description = "This Extension was created with the AppyBuilder Code Editor.<br>" + 
                   "Create your own here:<br><a href='https://editor.appybuilder.com' target='_blank'>https://editor.appybuilder.com</a><br>",
        category = ComponentCategory.EXTENSION,
        nonVisible = true,   iconName = "http://appyBuilder.com/extensions/icons/extension.png")
@SimpleObject(external = true)
public class Properties extends AndroidNonvisibleComponent {
    private ComponentContainer container;
    /**
     * @param container container, component will be placed in
     */
    public Properties(ComponentContainer container) {
        super(container.$form());
        this.container = container;
    }
  
  @SimpleProperty(description = "My Awesome Property")
  public String MyAwesomeExtension(){
    String hello = "This Is A Extensions";
    return hello;
  }
  
}


Youtube Video [HINDI]




Comments

Post a Comment