Here’s the ListAdapter that I am trying to bind my ListView with.
ListAdapter adapter = new SimpleCursorAdapter(this, R.layout.my_item,c,new String[] {"title","body"},
new int[] { R.id.TextView_Title,R.id.TextView_Body});
setListAdapter(adapter);
This works. But I am stuck at what I guess should be very simple. What I want to do is to display the title completely while I display a sub string of the body (say, first 10/15 chars). How do I do this in this case? Can I manipulate the cursor directly in a way so that it returns a substring at the first place or do I have to do it after the cursor has returned the values (in that case, how?). Thanks for the help.
EDIT: OK, sorry I thought you wanted to ‘get’ the substring of the body column but you want to ‘set’ it as a substring???
Implement
SimpleCursorAdapter.ViewBinderon your activity and overridesetViewValue().At some point in your code you’ll need to use…
…and the code would look similar to this…