已經做了很多搜索的使用下面的代碼我沒有其他帶出從SQLite數據庫表中的列表視圖後,提高列表視圖去除了得到由已知界解決。我提出simplecursoradapter的行導致它看起來的問題,我的應用程序停止。代碼中沒有其他錯誤。如果我評論simplecursoradapter這一行,這個錯誤不會出現,但是當然沒有listview。我無法使用simplecursoradaptor
Cursor c= vivzHelper.getAllRows();
String[] from = new String[]{ vivzHelper.NAME};
int[] to = new int[] {android.R.id.text1};
SimpleCursorAdapter cursorAdapter = new SimpleCursorAdapter(context,android.R.layout.simple_list_item_1,c,from,to,0);
ListView thislist=(ListView)findViewById(R.id.listView);
thislist.setAdapter(cursorAdapter);
public Cursor getAllRows() {
String where = null;
SQLiteDatabase db = helper.getWritableDatabase();
String[] columns = { VivzHelper.UID,VivzHelper.NAME};
Cursor c = db.query(VivzHelper.TABLE_NAME, columns, null, null, null, null, null);
if (c != null) {
c.moveToFirst();
}
return c;
}
應用程序停止。崩潰!檢查stacktrace並在此發佈 – Raghunandan 2015-03-19 05:16:39
您是否對xml的單行使用custom_row.xml? – Keshav1234 2015-03-19 05:17:51