I am using a method with a cursor to return all values that has the same id, like for example:
ID_Owner | ID_Car
1 -------- 1
1 -------- 2
The owner with the id, has the car 1 and 2..
With my method im returning those values:
// Seleciona o Registo com o ID especeficado
public Cursor selectMotivosWhereId(long id){
String sql = "SELECT * FROM Motivo_sintomas WHERE _ID IN (SELECT id_motivo FROM Sintoma_motivos WHERE id_sintoma = ?) " ;
String[] args = new String[]{id + ""};
Cursor result = this.db.rawQuery(sql, args);
return result;
}
And then, i want to show them in the same textview, but only the last one is displayed, i think its because the .setText overwrites and only the last one is shown.
Cursor res2 = dal.selectMotivosWhereId(position);
res2.moveToFirst();
while (!res2.isAfterLast()) {
Motivo.setText(res2.getString(res2.getColumnIndex(DBContract.Motivo_sintomas.COL_Motivo)));
res2.moveToNext();
}
How can i keep adding the values to the edittext and separate them with a "-" or "," ?
Thanks so much.