I'm trying to populate a list view with data from a table in SQL via a SimpleCursorAdapter
, but every time the activity opens, it crashes the app. Android Studio is not letting me see my error logs for some reason. Can someone please tell me what exactly is wrong with this code? It is inside my onCreate
method.
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);
never mind my table needed a _id column in order to use a SimpleCursorAdapter on it. So i ended up making a new database (i could have just made a new table instead, also).