I'm using the deprecated SimpleCursorAdapter to display data from Cursor to ListView. I've added the additional argument 0
, which removes the dreprecated warning, but I want to use a better way to display data. I've read something about Loader
, but don't know how to implement it. What would be a better alternative to the code below? How would this code be translated to use Loader?
Cursor c = mDbHelper.getAllRecords();
startManagingCursor(c); //this is also deprecated
String[] from = new String[] { "Name" };
int[] to = new int[] { R.id.text1 };
SimpleCursorAdapter names =
new SimpleCursorAdapter(this, R.layout.names_row, c, from, to, 0);
setListAdapter(names);
names_row.xml
to alter the way it is displayed. – Adrianadriana