Skip to content

Instantly share code, notes, and snippets.

@EarlOfEgo
Created December 14, 2011 19:38
Show Gist options
  • Save EarlOfEgo/1478117 to your computer and use it in GitHub Desktop.
Save EarlOfEgo/1478117 to your computer and use it in GitHub Desktop.
custom simplecursoradapter
private class MyCursorAdapter extends SimpleCursorAdapter {
public MyCursorAdapter(Context context, int layout, Cursor c,String[] from, int[] to) {
super(context, layout, c, from, to);
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
View view = super.newView(context, cursor, parent);
TextView tv = (TextView) view.findViewById(R.id.amountOfWinningText);
if(cursor.getInt(cursor.getColumnIndex("winningamount")) > 0)
tv.setBackgroundColor(Color.GREEN);
else
tv.setBackgroundColor(Color.RED);
return view;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment