Ive been struggling for a while with my rather simple app. This is my onCreate in my listactivity class:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
DB db = new DB(this);
db.open();
cur = db.getData(); //cursor with all data from an SQLite db
String[] from = new String[] { DB.KEY_FIRSTNAME,
DB.KEY_LASTNAME, DB.KEY_BDATE};
int[] to = new int[] { NOT SURE WHAT TO PUT HERE };
startManagingCursor(cur);
setListAdapter(new SimpleCursorAdapter(this,
android.R.layout.simple_list_item_1, cur, from, to));
db.close();
}
The getData() method returns a cursor from an sqlite database. the int[] used by the adapter defined over is where I think the problem lies, but I have no idea how to solve it. The list I get out is either blank. Only lines resembling the number of entries in the database or only 1 of the columns. I have tried int[] {android.R.id.text1, android.R.id.text1, android.R.id.text1, android.R.id.text1} and fewer entries, and text2 and Ive now tried to just make a textview and call that, but then it goes completely blank again.
I hope you can help me wrap my head around this. Thanks!