how to read/write data on Android?

mikedoub at gmail.com mikedoub at gmail.com
Sun Mar 18 22:35:35 EDT 2012


Misery loves company.  I saw your posting this morning so I tried to save settings in my app.  No Luck.  I seem to be having the same problem. 

  -= Mike
 
Sent from my BlackBerry device on the Rogers Wireless Network

-----Original Message-----
From: Nicolas Cueto <niconiko at gmail.com>
Sender: use-livecode-bounces at lists.runrev.com
Date: Mon, 19 Mar 2012 11:22:38 
To: How to use LiveCode<use-livecode at lists.runrev.com>
Reply-To: How to use LiveCode <use-livecode at lists.runrev.com>
Subject: Re: how to read/write data on Android?

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

_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


More information about the Use-livecode mailing list