Created
December 14, 2011 19:38
-
-
Save EarlOfEgo/1478117 to your computer and use it in GitHub Desktop.
custom simplecursoradapter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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