我試圖創建一個數據庫在sqlite ..但它沒有得到創建。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);
}
任何幫助表示讚賞
在文件資源管理器中無法看到數據庫。它僅適用於應用程序。你能插入和閱讀一些東西嗎? – vandzi 2013-04-07 17:38:43