Where is my sqlite database stored in android?
I have created a sqlite database in android, I can query it inside my code
but I cannot find it on the filesystem/sdcard.
I have checked the other SO questions, its NOT in data/data/package-name...
I do see a data entry on my app taking up 52kb space, so its there,
furthermore when I run the app again it does not trigger a OnCreate
meaning it already has the DB.
My phone is rooted & I am using a custom jelly bean rom that runs fine for
all intents and purposes.
Any ideas where it could be?
CODE c#
public class SqliteHelper : SQLiteOpenHelper
{
private const string DATABASE_NAME = "Book";
private const int DATABASE_VERSION = 1;
public SqliteHelper(Context ctx)
: base(ctx, DATABASE_NAME, null, DATABASE_VERSION)
{ }
// Method is called during creation of the database
public override void OnCreate(SQLiteDatabase db)
{
db.BeginTransaction();
try
{
db.ExecSQL("CREATE TABLE Chapters (Id INTEGER PRIMARY KEY
AUTOINCREMENT, Name TEXT NOT NULL);");
ContentValues cv = new ContentValues();
cv.Put("Name", "1. Family");
db.Insert("Chapters", null, cv);
cv.Put("Name", "2. Shopping");
db.Insert("Chapters", null, cv);
cv.Put("Name", "3. Work");
db.Insert("Chapters", null, cv);
db.SetTransactionSuccessful();
}
finally
{
db.EndTransaction();
}
//if(db.IsOpen())
// db.Close();
}
No comments:
Post a Comment