how to read/write data on Android?

Nicolas Cueto niconiko at gmail.com
Sun Mar 18 05:47:07 EDT 2012


Apologies for reposting this under a different subject but just cannot
figure out what I am doing wrong.

Having read about "specialFolderPath" in the Android release notes,
here is the script from my Android test app that I thought would
return  the "Hello world" contents of "file1.txt":
------
 put url ("file:" & specialFolderPath(“engine”) & slash & "file1.txt")
into tData
 put "If file1.txt is in engine-path, here are its contents:" & cr &
tData & cr & "--" & cr into tResult
 put url ("file:" & specialFolderPath(“documents”) & slash &
"file1.txt") into tData
 put "If file1.txt is in documents-path, here are its contents:" & cr
& tData & cr & "--" & cr after tResult
 put url ("file:" & specialFolderPath(“cache”) & slash & "file1.txt") into tData
 put "If file1.txt is in cache-path, here are its contents:" & cr &
tData & cr & "--" after tResult
-------

Not having ever created a stack/standalone that relied on files, these
are the 3 ways of adding "file1.txt" I tried before finally clicking
"Test" in the IDE:

(1) Standalone Application Settings > Copy Files > Add file...,  with
"Copy Reference Files" checked off
(2) Standalone Application Settings > Copy Files > Add file..., with
"Copy Reference Files" checked on
(3) (i) Standalone Application Settings > Copy Files > Remove entry"
(to remove "file1.txt")
    (ii) Stack Property Inspector > External References"  (to add
again "file1.txt")

But, whether specialFolderPath was "engine", "documents", or "cache",
on the Android tablet "tData" always shows as empty.

Also tried but got likewise nowhere writing data with "put tNewData
into url ("file:" & specialFolderPath(“cache”)".

An explanation about what I am doing wrong and how to fix would be
much welcome and appreciated.

--
Nicolas Cueto




More information about the use-livecode mailing list