android.widget.SimpleCursorAdapter.ViewBinder Java Examples
The following examples show how to use
android.widget.SimpleCursorAdapter.ViewBinder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AlertList.java From xDrip-Experimental with GNU General Public License v3.0 | 6 votes |
void FillLists() { // We use a - sign to tell that this text should be stiked through SimpleAdapter.ViewBinder vb = new SimpleAdapter.ViewBinder() { public boolean setViewValue(View view, Object data, String textRepresentation) { TextView tv = (TextView) view; tv.setText(textRepresentation.substring(1)); if(textRepresentation.substring(0, 1).equals("-")) { tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); } return true; } }; ArrayList<HashMap<String, String>> feedList; feedList = createAlertsMap(false); SimpleAdapter simpleAdapterLow = new SimpleAdapter(this, feedList, R.layout.row_alerts, new String[]{"alertName", "alertThreshold", "alertTime", "alertMp3File", "alertOverrideSilenceMode"}, new int[]{R.id.alertName, R.id.alertThreshold, R.id.alertTime, R.id.alertMp3File, R.id.alertOverrideSilent}); simpleAdapterLow.setViewBinder(vb); listViewLow.setAdapter(simpleAdapterLow); feedList = createAlertsMap(true); SimpleAdapter simpleAdapterHigh = new SimpleAdapter(this, feedList, R.layout.row_alerts, new String[]{"alertName", "alertThreshold", "alertTime", "alertMp3File", "alertOverrideSilenceMode"}, new int[]{R.id.alertName, R.id.alertThreshold, R.id.alertTime, R.id.alertMp3File, R.id.alertOverrideSilent}); simpleAdapterHigh.setViewBinder(vb); listViewHigh.setAdapter(simpleAdapterHigh); }