3

I am programming Android using LibGDX. I have pre-made database file. I can make database on android at runtime using this wraper, but I can't figure out how to use already made one.

I tried 2 ways to get it done:

1. To use this DataBaseHelper class example, but while in Android, I would just write:

DataBaseHelper myDbHelper = new DataBaseHelper(this);

in LibGDX I run into problem:

DataBaseHelper myDbHelper = new DataBaseHelper();  <--requires variable "android.content.Context"

2. Using internal file handler of LibGDX:

FileHandle mHandle = Gdx.files.internal("list.db");
mydb1 = DatabaseFactory.getNewDatabase(DATABASE_NAME,DATABASE_VERSION, DATABASE_CREATE, null);

but I don't know how to make contact between mHandle and mydb1.

Any ideas welcome how to do it in LibGdx, thanx

ShoulO
  • 448
  • 2
  • 7
  • 20
  • 1
    You can copy the DB to the assets folder and then at runtime copy it to the database directory as explaned [here][1] [1]: http://stackoverflow.com/questions/20207581/android-copying-database-from-asset-folder – dev.bmax Mar 10 '15 at 15:23

0 Answers0