Upload data file to emulator

tcgoh

Active Member
Licensed User
Longtime User
Hi,

I just get started on B4a and I don't have a android device yet.
How do I upload a database file onto the emulator for the SQL view program?
Thanks

TC
 

glook

Member
Licensed User
Longtime User
You can use adb (Android Debug Bridge).


Like this:
Start the Basic4Android IDE and your emulator session.

From Windows command line -
B4X:
adb push C:\MyProject\MyDatabase.sqlitedb /sdcard/MyDatabase.sqlitedb

If adb.exe is not in your Windows Path then you can find it in the platform-tools folder of the Android SDK.

Geoff.

Edit: This is useful - http://developer.android.com/guide/developing/tools/adb.html
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can also add the file to the Files tab (in the right pane). The file will then be included in the APK file and accessible from File.DirAssets.

As databases cannot be opened from this virtual folder you will need to first copy it to a writable location. DBUtils includes a method that copies the file if it doesn't exist.
 
Upvote 0
Top