当在定制的ROM中运行Android应用程序时,可能会遇到“安卓SQLite异常:在定制ROM上没有找到该列”的问题。这通常是由于以下原因之一导致的:
public class MyDatabaseHelper extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 1;
private static final String DATABASE_NAME = "myDatabase.db";
public MyDatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
// ...
}
public class MyDatabaseHelper extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 1;
private static final String DATABASE_NAME = "myDatabase.db";
private static final String TABLE_NAME = "myTable";
private static final String COLUMN_NAME = "myColumn";
public MyDatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
String createTableQuery = "CREATE TABLE " + TABLE_NAME + " (" +
COLUMN_NAME + " TEXT)";
db.execSQL(createTableQuery);
}
// ...
}
public class MyDatabaseHelper extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 1;
private static final String DATABASE_NAME = "myDatabase.db";
private static final String TABLE_NAME = "myTable";
private static final String COLUMN_NAME = "myColumn";
public MyDatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
String createTableQuery = "CREATE TABLE " + TABLE_NAME + " (" +
COLUMN_NAME + " TEXT)";
db.execSQL(createTableQuery);
}
// ...
}
通过以上方法中的一个或多个来解决“安卓SQLite异常:在定制ROM上没有找到该列”问题,可以确保应用程序在定制的ROM中正常运行。