Updated: Writing and Reading Text Files Using App Inventor

You may also like...

19 Responses

  1. Taifun says:

    Thank you for providing this tutorial. However there is one issue with your method of creating a list “of lists”, which has been discussed in the following thread in the App Inventor forum: https://groups.google.com/d/msg/mitappinventortest/0MaYmoHE18s/7D7NPjYSFQoJ

    Therefore I suggest you to adjust your example to really create a list of lists instead of creating a list of “csv rows” as currently…

    Kind Regards,

    • Edward M says:

      I’ll go back and take a look at what I was trying to accomplish with that example – to see whether a list of csv rows was, in fact, what was intended, but incorrectly described as a list of lists, or if I really should have a list of lists.

      Thanks of the heads up!


      • Edward M says:

        The error was in the text. As you noted, I had written “list of lists” when it should have read “list of CSV rows”. I corrected the text – thank you for spotting that! Ed

  2. Taifun says:

    in step 3 you are wondering, where the file is stored… the answer you can find in the documentation http://ai2.appinventor.mit.edu/reference/components/storage.html#File

    “If the filename does not start with a slash, it will be written in the program’s 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.”

    The AppInventor folder only is available on your development device…

    • Edward M says:

      The problem is also that the file may be stored in an ENT4 file system partition, as it appears to be on my phone when I tested that. I was trying to address questions I received from readers as to why the file was not visible when the phone was connected to Windows via USB, and how they might go about finding the file on their phone. Many of the people using App Inventor were probably not familiar with the concept of file systems nor that their phone or tablet has a file system. It is definitely true that programs run in the AI Companion are handled quite a bit differently than apps that are built and installed separately and I think it is a good suggestion to make that more clear! Thanks!


      • nadia says:

        ok can Edward M u help me i had made app in which i pick a file from SD card , i downloaded pdf reader , but when i run my app and pick a file from my android phone msg apears “no pdf reader is installed”

  3. DAvid says:

    and you seem to follow my question at the last part of the explanation…how do you split the individual items of each row? Thanks

    • Edward M says:

      I just arrived home from a week long vacation trip … I’ll take a look at your question in more detail after I get settled back into the regular routine! Sorry for the delay in responding… Ed

  4. now my files saved in /storage/emulated/0/AppInventor/data
    is there any possible way to save on my phone dropbox ?

  5. Ali Rıza B. says:

    My problem is create folder.
    How to make app2 with cerate folder?
    Because my ideas camera with picture save to folder.

    • Edward M says:

      I do not know of a way for an App Inventor app to create a folder; I think that feature is missing.

      One can be created manually by using a separate File Manager app (free, in the Google Play Store).

  6. Robert says:

    Hi Edward
    Thanks for the great Tut. What happens when you need to
    1. Read lets say a location (latitude, longitude and description) from a list or table of these, one record at a time? do you use a WHILE or For loop to access these values?

    • Edward M says:

      For a list, you can use the List method named “Is in list?” and pass to it the list to search, and the “thing” you wish to search for.

      For a table, I suppose you could convert the table into a list and then use the List search. Use “List from CSV table”, from the List components.

      Alternatively, yes, you could use a loop to scan through the list or table. But try using one of the built in searches first to see if that can solve your app requirement!


  1. September 23, 2015


  2. October 28, 2015

    […] have posted an updated tutorial that explains the details and shows how to store your files in the right location, how to find […]

  3. November 5, 2015

    […] sure to follow the links for more information about text files and where they are stored on your device and how to transfer […]

WP to LinkedIn Auto Publish Powered By : XYZScripts.com