Completely empty the TinyDB

That is to say, I want to delete all the elements of the list and that they are neither in the TDB, nor are they seen in the ListView... there are no examples of that in the book and I can't find them on youtube either

Now I have put it like this, it doesn't work either, I get the error

image

Lists... you might read
Programming Lists of Data

or

https://imagnity.com/tutorials/app-inventor/list-blocks-on-app-inventor/

Here are some resources to help you learn to use the AI2 tools. A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook App Inventor 2 Book: Create Your Own Android Apps ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.

There is a free programming course here Course In A Box and the aia files for the projects in the book are here: App Inventor 2 Book: Create Your Own Android Apps

How to do a lot of basic things with App Inventor are described here: How do you...? .

Also look here App inventor español. Offline. Tutorial. Ejemplos. Instalación. Códigos. Juegos. Curso gratis de App inventor. and here Tutorial Index | Imagnity for more tutorials

Learn about components Component Reference
and visit the Library The MIT App Inventor Library: Documentation & Support Help>Library on the MENU

1 Like

Thank you @SteveJG I will continue to review, ..

Greetings, I have reviewed most of the examples, they delete one by one... I am looking to eliminate all the records that disappear from the TDB and cannot be seen in Listview...
I would like to confirm what I have done because I get errors when I think the block is fine... :disappointed_relieved:

Simplify and test.

For those people with no access to AI2 books in their language, I have copied the Lists chapter (19) from the online MIT book to FAQ Section: Books, Tips, Tutorials for AI2 - #3 by ABG

The pictures are unchanged, and untranslatable, but at least the text can be translated using this board's translate facilities.

And maybe I'm not explaining well... the issue is not how much I have read or not seen on YouTube.
The issue is experience... and here I have stated that there is persistent data, that I make the changes that I make when I install the application... you see the data that should not be there, the ones that I have apparently already deleted in some way (for example with clear all TinyBD)
I would think that I should do something on the cell phone, that is, search in the folder explorer, but I have not done it until someone with more experience has told me that I should do that or it is simply a question of the blocks..
I hope you understand me

I'm having the same problem when testing on my phone!

I have a button in the app that does a 'TinyDB1.ClearAll', and exit
the app with 'close.application', but the data still persists in
memory when I relaunch the app.

So, I long-press the app icon to get the App Info dialog,
where I CLEAR STORAGE and CACHE. Then I UNINSTALL. Well, the
data is still found on the next launch!

The ONLY way I found is to create a new version of
the app (by changing Screen1 AppName). The new version
has no knowledge of the preceding one and everything
works.

I suppose rebooting would also fix this; didn't try it.

I am unable to replicate this reported problem in both companion and compiled mode.

Herewith a simple app that should demonstrate. (You will need to clearAllTags for this to work in companion mode, tags from other projects...)

tinyDBTest.aia (2.8 KB)

If you want an apk

1 Like

@SloVuj 's symptoms defy my knowledge of Android's storage system, even taking into account the possibility of different TinyDb NameSpaces.

Would you have a sample .aia we could try?

Show us that you use create empty list as the default for an empty list, not blank.

I have 6 HUGE screens and lots of virtual ones, but only one namespace,

so this is not the issue here. I suspect something to do with Android's

garbage collection, which is (maybe?) only run when actual storage memory

is needed. I suppose I could try rebooting, but it takes too long...

The app opens the Contacts and several of them are stored as

favorites in TinyDB, but even after zapping TinyDB, they show

up on the next run!

Sorry, I can't create a small reproducer. I'll stick to creating

a new version to get a clean slate when needed.

The delayed garbage collection idea sounds plausible.
That's something worth remembering.

Not sure what you are referring to, but in my Screen1.Initialize, I call a procedure which consists of about 20 Call DB.StoreValue tag... statements. I'm storing here Booleans, numbers and strings, no lists. The DB is used across 3 or 4 other screens. I'm not storing any lists, and I clear the db with a button which just does a call DB.ClearAll -- but data persists after I rerun the app. I'll do some more debugging...

Dear, @SloVuj I appreciate very much that you enter this topic and have noted that you also have the same problem. Thank you

I'm trying to prepare the .aia to go without useless blocks

Then I UNINSTALL. Well, the data is still found on the next launch!

What I meant here is, after UNINSTALL, I reinstall the same app, of course. The new
install still finds (at least some) data. For example, the app counts the number
of mails and SMS sent and stored them in the DB. The newly installed app
finds them and displays them!
My phone runs Android 9.0, if that matters.

This is because of

Taifun

2 Likes

Does clearing the cache and stored data of the Companion app make a difference?
(I know it shouldn't make a difference for compiled apps, but it's worth a try.)

I normally use the Companion, but I vaguely remember starting testing on a real device as well precisely because the Emulator kept stale data and was confusing me. I will try your suggestion.

Thanks you, for you help