I want to create a table with 1 predefine row in it. So, I am adding the row in onCreate();
Following is my code :
private static final String CREATE_CA
The table has 2 columns so you will either need to provide 2 values, or specify the column names you want to insert to. Change
INSERT INTO CATEGORYTABLE VALUES('Category 1')
to
INSERT INTO CATEGORYTABLE VALUES(NULL, 'Category 1')
or
INSERT INTO CATEGORYTABLE(category_name) VALUES('Category 1')
For what it's worth, it's also a bad practice to catch exceptions in onCreate()
or onUpgrade()
. If there's a problem, the callback should not return normally.