0
I need to change the color of the listview item according to the data coming from the database, I have a field visited that this receiving a "*" would like to change the color of the person who has already been visited.
I’m bringing the search this way:
players = new ArrayList();
var path = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), abrir.Nome_banco);
_connection = new SQLiteConnection(new SQLitePlatformAndroid(), path);
sqldb = SQLiteDatabase.OpenDatabase(path, null, DatabaseOpenFlags.OpenReadwrite);
sqldb = SQLiteDatabase.OpenOrCreateDatabase(path, null);
Android.Database.ICursor sqldb_cursor = null;
sqldb_query = "SELECT visitado,nome FROM pessoa where grupo_id ='"+grupo_id+"'order by nome asc";
sqldb_cursor = sqldb.RawQuery(sqldb_query, null);
if (!(sqldb_cursor != null))
{
}
if (sqldb_cursor.MoveToFirst())
{
do
{
//formando aqui
players.Add(sqldb_cursor.GetString(0) + sqldb_cursor.GetString(1));
} while (sqldb_cursor.MoveToNext());
}
Code of the Adapter:
adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, players);
lv.Adapter = adapter;
The color change should be done on the Adapter.
– ramaral
That, I would have some example?
– mba
Put the Adapter code in the question.
– ramaral
ramaral put the Adapter code.
– mba