I have a simple cursor adapter with a ListView that works just fine. I output the Name to one of 3 TextViews in the ListView item XML.
But, based on user preference, I want to change the name from "Jeff Jones" to "Jones, Jeff".
I thought I could do this with overriding the SetViewValue() method.
Just a simple
public boolean setViewValue(View view, Cursor cursor, int i) {
if (view.getId() == R.id.Name) {
String Name = cursor.getString(cursor.getColumnIndex(nameColumn));
Name = Name.substring(Name.lastIndexOf(" ") + 1) + ", " + Name.substring(0, Name.lastIndexOf(" "));
((TextView) view).setText(Name);
}
}
If I step through this in the debugger, I am correctly building the "Last, First" string and setting the TextView value. But the text shows up as "First Last" in the ListView.
Where's my mistake?
I forgot to return true to indicate that the value has been overridden.