Accessing Runtime Event into our Extension

I am developing Extension for Spreadsheet Use. so I use Web Class Object in my Extension. I want to copy Following Event into my source. How will be it possible ?

but i want to access following event into my Extension.
image

package com.Sheet;

import com.google.appinventor.components.runtime.Web;

import android.widget.Toast;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;

import com.google.appinventor.components.runtime.util.AsynchUtil;


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.AndroidViewComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
//import com.google.appinventor.components.runtime.Component;
import com.google.appinventor.components.runtime.EventDispatcher;
import com.google.appinventor.components.runtime.util.YailList;
import com.google.appinventor.components.runtime.TinyDB;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@DesignerComponent(version = 2, // Extension Version
                   description = "",
                   category = ComponentCategory.EXTENSION,
                   nonVisible = true,
                   iconName = "images/extension.png")
@SimpleObject(external = true)
public class Sheet extends AndroidNonvisibleComponent{
//public String Deploy="";
public String Input ="";
//public String SheetId ="";
//public String SheetName ="";
public String Global="";

public String Dl="";
public String Si="";
public String Sn="";

private Web Webs;
private Context context;

    public Sheet(ComponentContainer container) {
        super(container.$form());
		Webs = new Web(container);

        context = (Context) container.$context();
    }
	

	/*Property
    @SimpleProperty(category = PropertyCategory.BEHAVIOR)
    public String Prop() 
	{
        return "XYZZ";
    }
	*/
	
	@DesignerProperty()
    @SimpleProperty(description = " Set Values To Prop")
    public void deployedLink(String deployedLink) {
        this.Dl = deployedLink;
		Global = Dl + "?ID=" + Si + "&SH=" + Sn;
    }
	
	@DesignerProperty()
    @SimpleProperty(description = " Set Values To Prop")
    public void sheetID(String sheetID) {
        this.Si = sheetID;
		Global = Dl + "?ID=" + Si + "&SH=" + Sn;
    }
	
	@DesignerProperty()
    @SimpleProperty(description = " Set Values To Prop")
    public void sheetName(String sheetName) {
        this.Sn = sheetName;
		Global = Dl + "?ID=" + Si + "&SH=" + Sn;
    }
	
	
	
	
	
	
	
	@SimpleFunction(description = "Set ScriptDeployLink/webAppLink, ScriptID and Spreadsheet Name")
    public void SetDetails(String deployedLink,String sheetID,String sheetName)
	{
	 Global = deployedLink + "?ID=" + sheetID + "&SH=" + sheetName;
	
	  
    }

	@SimpleFunction(description = "Adding New Row To SpreadSheet By Entering New Values")
    public void AddNewRow(String values)
	{
	   this.Input = Global + "&func=Create" + values;
	   Webs.Url(Input);
	   Webs.Get();

    }



	@SimpleFunction(description = "Delete Perticular Spreadsheet ROW By Row Number")
    public void DeleteRow(int rowNumber)
	{
	   this.Input = Global + "&id=" + rowNumber + "&func=Delete";
	 Webs.Url(Input);
	   Webs.Get();
    }
	@SimpleFunction(description = "Read Or Restore Single Row Only")
    public void ReadSingleROW(int rowNumber)
	{
	   this.Input = Global + "&id=" + rowNumber + "&func=ReadOneRecord";
	Webs.Url(Input);
	   Webs.Get();
    }
	@SimpleFunction(description = "Update New Row Values By Entering Its Row Number")
    public void Update(int rowNumber,String newValues)
	{
       this.Input = Global + "&func=Update" + "&id=" + rowNumber +  newValues;
	Webs.Url(Input);
	   Webs.Get();
    }
	@SimpleFunction(description = "Get All Spreadsheet Data as a CSV TEXT")
    public void ReadALL()
	{
		//Concanation   
		this.Input = Global + "&func=ReadAll";
	   Webs.Url(Input);
	   Webs.Get();
    }



}

I Recived Following Methods in Output !

How to Do this ?

You know there is already a Spreadsheet component for Google Sheets, right?

yes i know.there are lots of spreadsheet extension available. i am not doing this for launching aix file.

so if user want to use your extension, they have to add another Web component?

No . Its only access class object . not whole component.

Thay dont need to add Web Component. :rofl:

then what is use of extension :rofl: :rofl: :rofl:

what you need is class java.net.HttpURLConnection

i dont know about java.net.HttpURLConnection

Just make your own event to return output?

But how i knows ! The event is fired !

All of the source code for App Inventor is open source on GitHub. You should probably take a look at the following two files:

  • appinventor/components/src/com/google/appinventor/components/runtime/Web.java
  • appinventor/components/src/com/google/appinventor/components/runtime/Spreadsheet.java

to see how they handle the asynchronous processing and handling of events.