Skip to first unread message

luchian...@gmail.com

unread,
Sep 2, 2014, 4:18:14 PM9/2/14
to mitappinv...@googlegroups.com
Hi. I'm trying to make an app that can write/read some data to/from a file (.txt).
For example, when pressing one button I want to write something, when pressing the second button I want to write something else and when pressing the third button I want to open the file.
I managed to write into the file, but I can't open it in the app (if I exit the app I can open the file by navigating into the phone storage). I think maybe I don't use the right path to open the file. I tried to store the file in the phone internal storage and then on the sd card but I keep facing the same problem.
Can anyone here that can help me?
app.JPG

Taifun

unread,
Sep 2, 2014, 4:48:14 PM9/2/14
to mitappinv...@googlegroups.com
the documentation says it all: if you want to read from the file stored on SD card, use one slash: /new.txt
Taifun

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.         



SaveFile(text text, text fileName)
Saves text to a file. If the filename begins with a slash (/) the file is written to the sdcard. For example writing to /myFile.txt will write the file to /sdcard/myFile.txt. If the filename does not start with a slash, it will be written in the programs private data directory where it will not be accessible to other programs on the phone. There is a special exception for the AI Companion where these files are written to /sdcard/AppInventor/data to facilitate debugging. Note that this block will overwrite a file if it already exists. If you want to add content to a file use the append block.
Reply all
Reply to author
Forward
0 new messages