Copy link to clipboard
Copied
I found sample use air connect sqlite from this website http://www.flashmove.com/forum/showthread.php?t=34778
I copy that code in a new Air for Android Templates.
then I tested in desktop was ok.I can do query,update,delete.....
but in Android emulator was fail.it couldn't connect to my sqlite file.
the image below I check my device data that can't find sqlite file inside.but I'm sure I pack sqlite file when publish apk.
can someone tell me how to connect sqlite correctly?Appeciately.
First, never use the nativePath property of File.applicationDirectory (as the example does). This isn't supported on Android. You get an empty string. While you could usually bypass the write-restrictions on te application directory using this technique on the desktop, it definitely does not work on Android. Always use URLs rether than native paths to refer to application files.
What you should do is create the database in the applicationStorage directory. You could do this with SQL, or by coping
...Copy link to clipboard
Copied
First, never use the nativePath property of File.applicationDirectory (as the example does). This isn't supported on Android. You get an empty string. While you could usually bypass the write-restrictions on te application directory using this technique on the desktop, it definitely does not work on Android. Always use URLs rether than native paths to refer to application files.
What you should do is create the database in the applicationStorage directory. You could do this with SQL, or by coping a "template" database file that you packaged with the application from the application directory o the application storage directory (using the URL not the native path, of course.)
Copy link to clipboard
Copied
Thank you so much.My probelm has solved.
Now I expect you have some CS5 for Android Samples control phone gps or camera.
Copy link to clipboard
Copied
Hi Joe,
can you put together some quick example of opening database file from sdcard? I'm struggling with it, also I hope it is not due to the un-rooted device.
best regards
Copy link to clipboard
Copied
I am trying to create an app that upon first running it in Android, it creates a new database on the SD so it can read/write data. The DB is simple, I want to store an image and a name of the image. The user creates images and then saves them to the DB. Are there any good exmaples of this? I am using Flash CS5.5 but cannot seem to find many examples that work.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now