how to read/write data on Android?

Nicolas Cueto niconiko at gmail.com
Sun Mar 18 22:22:38 EDT 2012


Thanks, Jacque, but still no luck.

I followed your suggestions to the letter, including the Copy Files
pane, and triple-checked all my typing (including quotation marks),
but still getting a false for "file1.txt exists". (Actually,
"file1.txt" is named "titleAndUniqueIDindex.txt".)

Thinking maybe the IDE's "test" function is the problem, I also built
a standalone apk, used Dropbox to transfer it to my tablet, and
installed from there. But still get false for "file1.txt exists".

Tried everything both with LC 5.0.2 and LC 5.5.rc2. Plus tried using
the "search" function of a file explorer app for Android, but could
not find my app or its folders (tho being new to Android, I don't
really know what to look for and where).

Here are the paths returned for "engine", "documents", and "cache",
followed by the script that implemented your path suggestion.

////////////////////////////////////////////////////////////////////////
file:/data/app/com.test_rc2.niconiko-1.apk/file1.txt
file:/data/data/com.test_rc2.niconiko/files/file1.txt
file:/data/data/com.test_rc2.niconiko/cache/file1.txt

--
put "nada" into tData
   put ("file:" & specialFolderPath("engine") & slash &
"titleAndUniqueIDindex.txt") into tPath
   answer "File in engine exists:" && there is a file tPath --
confirms existence
   if there is a file tPath then
      put url tPath into tData
   end if
   put "Engine path & data =" & cr & tPath & cr & tData & cr after tRez

   put "nada" into tData
   put ("file:" & specialFolderPath("documents") & slash &
"titleAndUniqueIDindex.txt") into tPath answer "File in documents
exists:" && there is a file tPath -- confirms existence
   if there is a file tPath then
      put url tPath into tData
      put "Documents path & data =" & cr & tPath & cr & tData & cr after tRez
   end if
   put "Documents path & data =" & cr & tPath & cr & tData & cr after tRez

   put "nada" into tData
   put ("file:" & specialFolderPath("cache") & slash &
"titleAndUniqueIDindex.txt") into tPath
   answer "File in cache exists:" && there is a file tPath -- confirms existence
   if there is a file tPath then
      put url tPath into tData
   end if
   put "Cache path & data =" & cr & tPath & cr & tData & cr after tRez
   put tRez into field "test"
///////////////////////////////////////////////////////////////////


Anyone?

--
Nicolas Cueto




More information about the use-livecode mailing list