I have a SimpleAdapter that I use in a listview to show data that comes from the database. Follow the code below
Map<String, String> map;
for(int i = 0;i < buscaCombustivel.getCount();i++) {
map = new HashMap<String, String>();
map.put("idItem", buscaCombustivel.getString(buscaCombustivel.getColumnIndex("id")));
map.put("text1", buscaCombustivel.getString(buscaCombustivel.getColumnIndex("dataEntrada")));
map.put("desc","Litros: " + buscaCombustivel.getString(buscaCombustivel.getColumnIndex("litrosEntrada")) + " | Valor unitário: " +
buscaCombustivel.getString(buscaCombustivel.getColumnIndex("valorUnitarioEntrada")) + " | Valor total: " +
buscaCombustivel.getString(buscaCombustivel.getColumnIndex("valorTotalEntrada")) + "\n");
list.add(map);
buscaCombustivel.moveToNext();
}
SimpleAdapter adapterDropDown = new SimpleAdapter(getApplicationContext(), list, R.layout.custom_list, new String[] { "text1", desc", "idItem" }, new int[] { R.id.text1, R.id.desc, R.id.idItem });
listDados.setAdapter(adapterDropDown);
R.id.text1, used in SimpleAdapter, has a property called DrawableLeft in its xml. I needed to change this property depending on a certain value that comes from the database. Is it possible to do that?