Can not write text file

So instead of using a text file I could use a tinydb with only one tag

Please explain what you mean ?

I'm sorry, only one tag, not key. I need it to write notes

How do you get the data into the tag/value for a distributed app?

Here is my idea

What is the goal?

See also here (especially → point 2):

My goal is to read/write notes into internal storage, I can not do it with a textfile, then I'm trying with a multiline textbox and tinydb.

I think this tutorial can help you :

Try something like this:

This way the text is saved in the Internal Storage:


See also here (→ point 1.2.):

Thank You Anke for suggestion, it does not solve my problem, but I tried with the following code (filename without slash) with success. Can you explain me why ?

Why? In what way?

That's exactly what I have shown.

No, this does not work the first time you run the app because there is currently no text file in the Private directory.

Yes, You ara right the first time I receive a warning, but after typing some words I can save file without problems. When I tried your blocks with 2 files I was not able to read saved words

I didn't use 2 files (only one: text.txt). I only added some text " + def`".
So where is the problem?

Maybe I can not understand your code, you save in private dir, but you read from //

Look at my blocks:

I only read from //text.txt because I want to get the text from the text.txt file (stored in the assets).
When I got that text, I save it in the new text.txt file in the Private dir.

(Btw, no need to add " + def". This was only an example.)

I can understand well the above blocks, but when I run the app the second time I read from // original file without changes. Why not so ?

Try this:


This way the text is only read for the first run of the app.
Then the new text.txt file is created in the Private dir and the text may be changed.
When the app is restarted or the screen is reopened the block (btReadText) will never be executed because if(TinyDB.GetValue -> firstRun) = false.

It's OK, but can you answer to my post 23 ? what do you think about my blocks ?

Please explain exactly what the goal is (what should be achieved):

  1. Read the text file (appunti.txt) from the assets (at Screen.Initialize ?).
  2. Save the text in the new file (appunti.txt) in the Private dir.
  3. ...
  4. ...

my goal is to avoid error on first run

  1. Read the text file (appunti.txt) from Private dir
  2. if not exist (screen error) save the text in the new file (appunti.txt) in the Private dir.
    then add text and save