0
这是当我尝试运行我的应用程序在Android中非法参数异常:列_id不存在
非法参数异常,我发现了错误:列_id不存在
public static final String OBJ_ID="_id";
和数据库的创建如下:
private static final String CREATE_TAB1= "create table " + TABLE_1 + " (" + OBJ_ID + " integer primary key
autoincrement, " + OBJ_NAME + " text not null, " + DESC1 + " text not null, " + DESC2 + " text not null);";
试图通过使用在数据库处理器以下函数来检索数据:
public Cursor getAllTable1() {
return db.query(TABLE_1,
new String[] { OBJ_NAME },
null, null, null, null, null);
}
这就是虽然我的数据库架构由一个名为列_id在那里我有DATABSE
public class List_View extends ListActivity {
public void onCreate(Bundle icicle)
{
super.onCreate(icicle);
setContentView(R.layout.displayitems);
Databasehelp db = new Databasehelp(this);
db.open();
Cursor cursor = db.getAllTable1();
startManagingCursor(cursor);
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
R.layout.list_example_entry, cursor,
new String[] {"name"},
new int[] {R.id.name_entry });
setListAdapter(adapter);
}
}
通信的功能。我改变这个甚至_ID但似乎没有工作。任何人都可以帮我解决这个问题吗?
非常感谢@Sam – ARK