java - can't find databases folder under data/data/packagename/ using eclipse android emulator -
i'm having problem sqlite android. according examples found internet, databases can found under data/data/packagename/ can't find folder under directory.
please tell me what's problem?
and provide sqlitehelper class in case if it's necessary .
package com.example.waterrefilltest; import static android.provider.basecolumns._id; import android.content.contentvalues; import android.content.context; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; public class data extends sqliteopenhelper{ private static final string database_name = "waterrefill.db"; public data(context ctx){ super(ctx, database_name, null, 4); } public void generatedata(content c){ sqlitedatabase db = this.getwritabledatabase(); contentvalues cv = new contentvalues(); cv.put("lat", c.getlat()); cv.put("long", c.getlng()); cv.put("cat",c.getct()); cv.put("rat", c.getrt()); cv.put("ph",c.getph()); cv.put("distance", c.getdistance()); db.insert("contents", null, cv); db.close(); } public void deletedata(sqlitedatabase db){ db.execsql("drop table contents"); } @override public void oncreate(sqlitedatabase db){ db.execsql("create table contents ("+_id+" integer primary key autoincrement , lat text , longi text , cat text , rat text , ph text , distance text );"); } @override public void onupgrade(sqlitedatabase db, int oldversion, int newversion) { db.execsql("drop table if exists contents"); oncreate(db); }
}
i guess databse not created yet. thats why not able see it. try in mainactivity class:
data dt = new data(this); sqlitedatabase db = dt.getreadabledatabase();
database created when oncreate called , when call getreadabledatabase() oncreate called , database created
Comments
Post a Comment