我试图在 sqlite 中创建一个数据库..但它没有被创建。
文件资源管理器中没有显示数据库文件夹。
任何人都可以在下面给定的代码中发现任何错误
public DatabaseHelper(Context context) {
super(context, databasename, null, databaseversion);
Log.d("DatabaseHelper", "Reached Database helper");
mContext = context;
}
@Override
public void onCreate(SQLiteDatabase db) {
String CREATE_MASTER_TABLE = "CREATE TABLE " + table_reminder_master
+ "(" + MASTER_ID + " INTEGER PRIMARY KEY ," + MASTER_TITLE
+ " TEXT," + MASTER_CONTACT_ID + " INTEGER," + MASTER_EMAIL_ID
+ " INTEGER," + MASTER_TYPE_ID + " INTEGER," + ")";
db.execSQL(CREATE_MASTER_TABLE);
Log.d("Table Create", "The table is created");
Toast.makeText(mContext, "Created", Toast.LENGTH_LONG).show();
String CREATE_CONTACT_TABLE = "CREATE TABLE " + table_contactDetails
+ "(" + CONTACT_ID + " INTEGER PRIMARY KEY ," + CONTACT_NAME
+ " TEXT," + ")";
db.execSQL(CREATE_CONTACT_TABLE);
}
调用类
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
db = new DatabaseHelper(this); // instantiation of database helper
initializerMethod();
reminder=new Reminder_Master();
contact=new Contact_Details();
Log.d("Main Acitivity", "Message");
btnSave.setOnClickListener(saveHandler);
}
任何帮助表示赞赏