Here's my app, the AVD starts up but when I try to open the app I get a message
"Your App has stopped working unfortunately"
This is my Logcat details:
Caused by: android.database.sqlite.SQLiteException: near "TABLEproducts": syntax error (code 1): , while compiling: CREATE TABLEproducts(_idINTEGER PRIMARY KEY AUTOINCREMENTproductnameTEXT);
Any help is more than appreciated.
Here is the Code:
public class MyDB extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 1;
private static final String DATABASE_NAME = "store.db";
public static final String TABLE_PRODUCTS = "products";
public static final String COLUMN_ID = "_id";
public static final String COLUMN_PRODUCTNAME = "productname";
public MyDB(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
super(context, DATABASE_NAME, factory, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
String query = "CREATE TABLE" + TABLE_PRODUCTS + "(" +
COLUMN_ID + "INTEGER PRIMARY KEY AUTOINCREMENT" +
COLUMN_PRODUCTNAME + "TEXT" +
");";
db.execSQL(query);
}