I created a task application to be made that is displayed in a ListView.
I'm using SQLite with a table with the columns: ID, task, completed.
I want you to scroll through the records, if the "completed" column is equal to "s", the text in the ListView will appear with a scratch in the middle of it. Is there any way to do this?
This code is in the recovery method Tasks () that searches all jobs registered in the SQLite database:
//Recuperar as tarefas
Cursor cursor = bancoDeDados.rawQuery("SELECT * FROM tarefas ORDER BY id DESC", null);
//recuperar ids das colunas
int indiceColunaId = cursor.getColumnIndex("id");
int indiceColunaTarefa = cursor.getColumnIndex("tarefa");
int indiceColunaConcluida = cursor.getColumnIndex("concluida");
//cria o adaptador
itens = new ArrayList<String>();
itensAdaptador = new ArrayAdapter<String>(getApplicationContext(),
R.layout.items_list,
android.R.id.text1,
itens);
idsTarefas = new ArrayList<Integer>();
listaTarefas.setAdapter(itensAdaptador);
//Lista as tarefas - quando usa o rawquery ele fica parado no ultimo registro
cursor.moveToFirst();
while (cursor != null){
if (cursor.getString(indiceColunaConcluida) == "s"){
itens.add(cursor.getString(indiceColunaTarefa));
//Aqui quero colocar que o texto fica riscado
} else {
itens.add(cursor.getString( indiceColunaTarefa ));
//Aqui o texto deve ficar normal (sem risco)
}
idsTarefas.add( Integer.parseInt( cursor.getString(indiceColunaId) ) );
cursor.moveToNext();
}