Access tinydb inside extension developement

What about doing a Google search?

Taifun

2 Likes

any other simple way to store and get Java Array into TinyDB.
i think sharedPreference are just working like programatically text editor.

1 Like

How to write this code in extension.

WE CAN EASILY DO IN BLOCKS.

tinyDb.getDataValue(myTag,YailList.makeEmptyList())

But Its Not Working in Extension.

 @SimpleFunction(description = "Get Tag Value as and Empty YailList")
public void getTinyList(String myTag) {
  ArrayList<String> Ins = new ArrayList<>();

    Ins = getArr(tinyDb.getDataValue(myTag,YailList.makeEmptyList()));
    Ins.add("One");
    Ins.add("Two");

  tinyDb.StoreValue(myTag,YailList.makeList(Ins));
  
}

public  ArrayList<String> getArr(YailList values) {
    ArrayList<String> Strl = new ArrayList<>();
    for (String val : values.toStringArray()) {
      // parsed String
      String d = String.valueOf(val);
      Strl.add(d);
    }
    // and now you have the double list
    return Strl;
  }

Following Line Producing Error
Ins = getArr(tinyDb.getDataValue(Tabs,YailList.makeEmptyList()));

                ^

Any Solution ?

@Taifun 's extension

used SharedPreferences, you may want to have a look.

1 Like

This happens when you grow with copy-pasting. It is not a bad practice, but at least try to understand what code says before proceeding.

You should check Tiny DB source.

GetValue method accepts two parameters: key and default value

getDataValue accepts just one parameter: key

1 Like

Thanks to Reply . . .
You are right another reason of this problem bunks in practical in engineering collage. and also copy pasting in practical exam. Thanks to Support Back Bencher ! :slightly_smiling_face:

Can we use System.out.println("App Inventor \n"); while Writing Extension ? for Live Testing Purpose.

It won't work. That is not an android java function.

1 Like

What about using logcat?

Log.d(LOG_TAG, "hello world");

Taifun

1 Like
Log.d(LOG_TAG, "hello world");

this will displayed on any terminal ?

terminal ~ hello world

Taifun

Yes, you can use it.

To get logs for specific tag, run this command:

adb logcat -s TagName
3 Likes
adb logcat -s System.out

System.err, System.out

Since when? Someone needs to explain this to me.

Give it a try, you will understand.

It doesn't compile for me :confused: It never worked.

Currently I am Using .


@SimpleFunction(description = "TesterMethod")
public String tesTing(String txt) {
testingTxt = testingTxt + "\n" + txt;
return testingTxt;
}

This will Work While Runtime .
I am Using Linux Mint OS.

Sometimes I don't see Log.d() output in logcat so I always use it in conjugation with System.out.

2 Likes

4 posts were split to a new topic: I want to run some Extension Methods in Synchronous Task

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.