出现此错误时,我正在编写DatabaseHelper代码。
public class DatabaseHelper extends SQLiteOpenHelper {
private static final String DB_NAME = "Items.db";
private static final String DB_TABLE = "Items_Table";
private static final String DB_TABLE1 = "Items_Table1";
private static final String NAME = "NAME";
private static final String ID = "ID";
private static final String ID1 = "ID1";
private static final String PLACE = "PLACE";
private static final String CREATE_TABLE = "CREATE TABLE " + DB_TABLE + " (" + ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + NAME
+ " TEXT " + ")";
private static final String CREATE_TABLE1 = "CREATE TABLE " + DB_TABLE1 + " (" + ID1 + " INTEGER PRIMARY KEY AUTOINCREMENT, "+
PLACE + " TEXT " + " , " + ID + " INTEGER REFERENCES " + DB_TABLE + ")";
public DatabaseHelper(Context context)
{
super(context,DB_NAME,null,1);
}
public void onConfigure(SQLiteDatabase db)
{
super.onConfigure(db);
db.setForeignKeyConstraintsEnabled(true);
}
public void onCreate(SQLiteDatabase db)
{
db.execSQL(CREATE_TABLE);
db.execSQL(CREATE_TABLE1);
}
我收到一个Android studio错误:非法字符:'\ u2028'。这是什么意思,我该如何纠正。
答案 0 :(得分:0)
这是换行符,如果您转到引起错误的每一行并删除“不可见”的最后一个字符,则错误将得到解决
对于导致错误的行,请对每个具有非法字符错误的行进行一次退格
您还可以使用Android Studio中的替换功能,在“替换为”中放置一个空字符串来代替此非法字符。