Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 5 years ago.
I have the problem that i would like to create an custom design for my list view but I don't know how to do. I use a sql database which is in my list view. haha sorry I dont't know how to say this...because im german..so by the way sorry for my englsih. here is my code:
private void populateListViewFromDB() {
Cursor cursor = myDb.getAllRows();
startManagingCursor(cursor);
String[] fromFieldNames = new String[]
{DBAdapter.KEY_NAME, DBAdapter.KEY_STUDENTNUM, DBAdapter.KEY_FAVCOLOUR, DBAdapter.KEY_STUDENTNUM};
int[] toViewIDs = new int[]
{R.id.item_name, R.id.item_icon, R.id.item_favcolour, R.id.item_studentnum};
SimpleCursorAdapter myCursorAdapter =
new SimpleCursorAdapter(
this,
R.layout.item_layout,
cursor,
fromFieldNames,
toViewIDs
);
// Set the adapter for the list view
ListView myList = (ListView) findViewById(R.id.listViewFromDB);
myList.setAdapter(myCursorAdapter);
}
Thank you for helping!:)