SQLLite Database storage in Emulator

JaunLukePicard

Member
Licensed User
Longtime User
This may seam like a dumb question. Where are databases stored while working with the Emulator? Can I specify the location regarding the SD card as indicated in the Emulator?

For example.

I have a Galaxy S with a 16MB SD card. I indicate this when initializing the Device Emulator through the AVD manager. For this project I want to create a small SQLLite DB to test with. Where is this database stored while working with the Emulator?

Thanks!
 

JaunLukePicard

Member
Licensed User
Longtime User
The answer is no. The emulator doesn't use Windows file system. It creates its own file system in a single file.

You can use 'adb' tool to pull files from the emulator.


I checked the documentation. I found that I can MakeSDCard of the size I wish to use. And from your post it appears that I'll have just one file including the database I create.

If this is the case and I have completed creating the SD card image in AVD Manager for the phone do I reference the database I created on my PC to be included or do I have to have the DB created when the Emulator starts emulating my application? Could you show me an example?

I did see the Files tab in Basic4Androud. Do I use it? :sign0085:
 
Upvote 0

Brad

Active Member
Licensed User
Longtime User
You would add the db to your asset using the Files tab. You cannot write to it while it is in the asset folder so if you need to write to it, use the file.copy command to create a copy to a folder where it can be used.
Example:
B4X:
If FirstTime Then
  If file.Exists(file.DirInternal,nameofdb) = false ' make sure it doesn't exist
   file.Copy(file.DirAssets,nameofdb,file.DirInternal,nameofdb)
 end if
'
'
'
End if
 
Upvote 0
Top