• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Modify data in a cursor

ralphtrent

Member
Mar 8, 2010
67
6
Hi, I am new to android dev so please bare with me. I have been looking all day and found nothing that does what I want to do.
I have data in a db and I need to manipulate its values when I display it.
here is the code I have so far
Code:
adapter = new SimpleCursorAdapter(this, R.layout.clock_item, c, FROM, TO);
ListView lv = (ListView) findViewById(R.id.list);
lv.setAdapter(adapter);
adapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
 @Override
 public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
 TextView tv = (TextView)view;
 if(columnIndex == 0)
 {
  Log.i(TAG, "Current Text:" + tv.getText());
  tv.setText("Hello");
  Log.i(TAG, "Current Text:" + tv.getText());
 }
}
When I look at the logCat for my tags I see this:
Code:
Current Text:
Current Text:Hello
Current Text:test
It looks like I am setting the text too early? AM I? On the screen test (which is the value from the db) still get displayed, but I want "Hello".
Any help is appreciated.
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones