Can't write file to SHARED directories on API31 (Android 12)

Yes. This ensures that each item in your list is appended to the file and saved before the next item.

Don't see this as an issue. You won't be accessing the file whilst you add items from your list ? Using a counter means it has to be a global variable. Not sure what you mean by buffer ?

Length of lines in a text file, size of a text file, and size of data stored in a tinydb are generally limited by the storage memory capacity of the device. Others have stored entire books/novels in a single file, and displayed then in a single label.