Hi, I've pinched a lot of code from the beginners book with regards to loading a csv into a panel (Chapter 12).
Got all that working how I want so that when a user clicks on a cell it changes the value depending on the value that is already there. The problem is I can't seem to save it!
It opens the files from File.dirassets but when I try and save there it tells me the file doesn't exist. I read somewhere that this folder is read only, so how then can I open a csv, edit it in my panel and then save my changes? Or where should I put it so I can do this?
You should copy the file from DirAssets to another directory.
Something like this:
B4X:
If FirstTime = True AND File.Exists(File.DirRootExternal, "persons.csv") = False Then
File.Copy(File.DirAssets, "persons.csv", File.DirRootExternal, "persons.csv")
End If
LoadTableFromCSV(File.DirRootExternal, "persons.csv", True)
File.DirRootExternal could be another directory like File.DirInternal.
Thank you Klaus. What I don't understand at the moment is 1 - would that overwrite my original file (which is what I want it to do) and 2 - how do I do this in the testing phase?
I kind of get the idea that I need to be more specific for file paths when it is actually installed to my device but while I'm testing what do I do to write back to this file from my panel and save it?
I'm getting there now, it's saved the file where I want it to, it's just only the headers. It doesn't seem to be populating the actual table again with any of the labels.....