我試圖通過SimpleCursorAdapter
來用在SQL表中的數據的列表視圖,但每次活動時間打開,它崩潰的應用程序。出於某種原因,Android Studio不讓我看到我的錯誤日誌。有人可以告訴我這段代碼究竟有什麼問題嗎?它在我的onCreate
方法中。應用程序崩潰,當我嘗試填充列表視圖與SQL表
db = openOrCreateDatabase("namesAndscoresAndtimes", SQLiteDatabase.CREATE_IF_NECESSARY, null);
c = db.query("namesAndscoresAndtimes", null, null, null, null, null, null);
String[] fromCols = { "name", "score", "time", "percentile" };
int[] toViews = { R.id.name, R.id.score, R.id.time, R.id.points };
SimpleCursorAdapter sca = new SimpleCursorAdapter(this, R.layout.scr, c, fromCols, toViews, 0);
ListView lv = (ListView) findViewById(R.id.scoretables);
lv.setAdapter(sca);
您能夠在Android Studio中看到Longcat通過「Android設備監視器」。 – 2014-11-24 03:32:00