Created
December 18, 2020 05:26
-
-
Save cody-tech/07a5b75ff8fd0edf90892d63abd2e524 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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