Can't create handler inside thread

I have a SQLite database that I have copied to /storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/assets/MyAppDiary.db

I have downloaded bennedum.SQLite.aix

When I run the App through AI companion the database loads and I can run select queries that work.

If I build the app as a .apk and install it on my phone, I get "Can't create handler inside thread" error message when trying to load the database using the following:-

Any help would be appreciated.

Try:

//MyAppDiary.db

that should be all you need in companion and compiled app. Note that this will be read only. If you want to edit the database then you should IMPORT the database, and not set the DBName.

Thanks for the response, I have tried OpenDatabase //MyAppDiary.db and get the following error:- Can't toast on a thread that has not called looper prepare()

Ah yes, DBName requires an absolute path.

To use it, you will have to copy the DB file from the assets to your ASD, then supply the absolute path to the copied db file.

Much easier to IMPORT the db file from the assets, then to EXPORT it to the ASD.

You can't copy something to the assets, because the assets are read only
Use ASD instead...

Taifun

Sorry, I am new to App Inventor, how would I do that?

Use the extension blocks for IMPORT and EXPORT

Can anyone help me with creating blocks for Import and Export tried a few things and can't get it to work. When I import then export and open table I just get a empty table.

You may have more luck with this remix of that extension:

or this

https://puravidaapps.com/sqlite.php

Both provide guides on usage

first import the database, then add some records using a INSERT INTO statement, then send a SELECT statement to the database to get the desired result or export the database

Taifun