1
I created an application of tasks to be done that are presented in a Listview.
I am using Sqlite with a table with the columns: ID, task, completed.
I want that when I go through the records, if the "completed" column equals "s" the text in Listview appears with a scratch in the middle of it. Is there any way to do that?
This code is in the retrieveTarefas() method that searches for all tasks 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();
        }
Related: How to format text in a Textview
– ramaral