wuntee
wuntee

Reputation: 12490

Android: is it possible to access a sqlite file that is bundled with my application?

I have a database that I have already populated locally. I want to bundle it with my applications and access it at runtime (never want to re-write it anywhere, nor write to the database, simply read). What is the path of a file that I have added to the bundle? And, can i use that path with a SQLiteDatabase.openDatabase ?

Upvotes: 2

Views: 1101

Answers (1)

fazo
fazo

Reputation: 1827

well - you answered your own question

static SQLiteDatabase  openDatabase(String path, SQLiteDatabase.CursorFactory factory, int flags)

Open the database according to the flags OPEN_READWRITE OPEN_READONLY CREATE_IF_NECESSARY and/or NO_LOCALIZED_COLLATORS.

looks like you can

(of course you don't call it with CREATE_IF_NECESSARY, but OPEN_READONLY)

Upvotes: 1

Related Questions