public class DatabaseHandler extends SQLiteOpenHelper {
// All Static variables
// Database Version
private static final int DATABASE_VERSION = 1;
// Database Name
private static final String DATABASE_NAME = "contextsManager";
// Locations table name
private static final String TABLE_LOCATIONLABLES = "locationLables";
// LOCATIONLABLES Table Columns names
private static final String KEY_LOCID = "loc_id";
private static final String KEY_LOCNAME = "loc_name";
public DatabaseHandler(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
// Creating Tables
@Override
public void onCreate(SQLiteDatabase db) {
String TABLE_LOCATIONLABLES = "CREATE TABLE " + TABLE_LOCATIONLABLES + "("
+ KEY_LOCID + " INTEGER PRIMARY KEY," + KEY_LOCNAME + " TEXT,"
+ ")";
db.execSQL(TABLE_LOCATIONLABLES);
}
提示說的是局部變量TABLE_LOCATIONLABLES可能沒有被初始化?可是我初始化了的呀,這個錯誤如何發生的呢?
String TABLE_LOCATIONLABLES = "CREATE TABLE " + TABLE_LOCATIONLABLES + "("
等號兩各有一個,而且String TABLE_LOCATIONLABLES
這個還是新定義的,計算機迷糊了,它不認為你上面已經定義了