Skip to content

Instantly share code, notes, and snippets.

@cody-tech
Created December 18, 2020 05:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cody-tech/07a5b75ff8fd0edf90892d63abd2e524 to your computer and use it in GitHub Desktop.
Save cody-tech/07a5b75ff8fd0edf90892d63abd2e524 to your computer and use it in GitHub Desktop.
package com.extensions.testtinydb;
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 Testtinydb extends AndroidNonvisibleComponent {
private ComponentContainer container;
/**
* @param container container, component will be placed in
*/
public testtinydb(ComponentContainer container) {
super(container.$form());
this.container = container;
}
@SimpleFunction(description = "Stores a value in TinyDB")
public void StoreValue(final String tag, final String valueToStore) {
TinyDB tinyDB = new TinyDB(container);
tinyDB.StoreValue(tag, valueToStore);
}
@SimpleFunction(description = "Retrieves value of a tag")
public Object GetValue(final String tag, final Object valueIfTagNotThere) {
TinyDB tinyDB = new TinyDB(container);
return tinyDB.GetValue(tag, valueIfTagNotThere);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment