Would very much appreciate any help or hint on were to go next.
I\'m trying to change the content of a row in ListView programmatically. In one row there are 3 TextV
Actually you should use a ViewBinder to achieve your custom binding. This way you do not have to override any code. Just make sure that you return true when you have set the value of the view otherwise the adapter will overwrite the value.
public void refresh() {
Cursor cursor = ....get cursor....
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
R.layout.list_item,
cursor,
new String[] { KEY_NAME, KEY_SHORT_DESC},
new int[] { R.id.icon, R.id.text1});
adapter.setViewBinder(new ProductViewBinder());
setAdapter(adapter);
}
private static class ProductViewBinder implements ViewBinder {
public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
if (view instanceof ProgressBar) {
String result = cursor.getString(2);
Int resInt = Int.parseInt(result);
if (resInt == 0) {
((ProgressBar)view).setIndeterminate(true);
return true;
}
}
return false;
}
}