Page 1 of 1

Using the documents folder in Android

Posted: Sat Dec 31, 2011 12:29 am
by Jason1234
I have been trying to get this to work and hopefully someone can advise where I am going wrong...

At the install settings on Android device I am trying to locate the SQLite database in the documents folder in Android so that I can open it.. apparently you can't open databases in the engine folder.

Following advice from various postings I found this is what I have done so far.

At the setting page see I have added the database file and set the Copy Referenced File to: specialFolderpath("documents") this is exactly what I entered so if this is incorrect syntax please let me now...

Also the code that then opens the database file that should have been installed in the correct location is:

Code: Select all

  if the environment is "mobile" then
         put specialFolderPath("documents") & "/fujserv.db" into pathNdb
          else
      set the itemDelimiter to "/"
      put item 1 to -2 of the effective filename of this stack into pathNdb
      put pathNdb & "/fujserv.db" into pathNdb
   end if
     
     ## Open a connection to the database
         put revOpenDatabase("sqlite", pathNdb, , , ,  ) into conID

       answer "Connected to: " & pathNdb & return & " conID is: " & conID
The database file is connecting but not the file I loaded but to a file created at runtime as not found.

Any help would be really appreciated as this has got me stumped. It is probably something basic again... :oops:

Regards

Jason

Re: Using the documents folder in Android

Posted: Sat Dec 31, 2011 12:54 am
by Jason1234
Amazing.... finally found the post with the answer....

For anyone else..

http://forums.runrev.com/viewtopic.php? ... 809#p48809

Thanks & Kudos to the original poster!

I would still like to know the correct syntax for directly copying to the documents folder in Android when building the application...

Jason