I am creating an object of class which has Sqlite database methods but when I call that class, my constructor is called but call is not going inside onCreate method..
My call is again returned back to caller class ...please tell me what I do to take the call inside onCreate method
I am calling KotDBHelper class using:
QueryListBean queryListBean=new QueryListBean();
queryListBean.setQueryList(queryList);
db=new KotDBHelper(context,queryListBean);
db.getWritableDatabase();
my code for sqlite helper class
public class KotDBHelper extends SQLiteOpenHelper {
private static final int DB_VERSION = 3;
private static final String DB_NAME = "eKOT";
ArrayList<String> queryList;
KotDBHelper objKotDBHelper;
BeanInterface bean;
/*private static final String TABLE_CATEGORIES="category_master";
private static final String TABLE_KOT="kot_master";
private static final String TABLE_ITEM="item_master";
private static final String TABLE_KOT_DETAIL="kot_detail";
private static final String TABLE_WAITER_MASTER="waiter_master";
private static final String TABLE_TABLE_MASTER="table_master";
private static final String TABLE_CONFIGURATION_MASTER="configuration_master";
private static final String TABLE_USER_MASTER="user_master";*/
public KotDBHelper(Context context,BeanInterface bean){
super(context, DB_NAME, null, DB_VERSION);
this.bean=bean;
}
@Override
public void onCreate(SQLiteDatabase db) {
try{
String address;
BluetoothAdapter adpt=BluetoothAdapter.getDefaultAdapter();
address=adpt.getAddress();
// casting bean here
QueryListBean objBean=(QueryListBean)bean;
objBean.getQueryList();
AsyncClass objAsyncClass=new AsyncClass(objKotDBHelper,null,address);
objAsyncClass.execute("");
for(int i=0;i<queryList.size();i++){
db.execSQL(queryList.get(i));
}
/*db.execSQL(CREATE_TABLE_CATEGORIES);
db.execSQL(CREATE_TABLE_ITEM);
db.execSQL(CREATE_WAITER_MASTER);
db.execSQL(CREATE_TABL_KOT);
db.execSQL(CREATE_TABLE_KOT_DETAIL);
db.execSQL(CREATE_TABLE_MASTER);
db.execSQL(CREATE_CONFIGURATION_MASTER);
db.execSQL(CREATE_USER_MASTER);
db.execSQL("insert into table_master(table_no,curDate,type) values(1,'','Room')");
db.execSQL("insert into table_master(table_no,curDate,type) values(10,'','Table')");
db.execSQL("insert into user_master(username,password) values('admin','admin')");*/
}catch(Exception e){
e.printStackTrace();
}
}