1
Hello, someone could help me ,the update is not updating the data!
Follow the button that calls the method:
@Override
public void onClick(View v) {
Receita rec = new Receita();
String dosradio = null;
switch(rg.getCheckedRadioButtonId()){
case R.id.rbCmp:
dosradio = "cmp";
break;
case R.id.rbMl:
dosradio = "ml";
break;
}
if (getIntent().getExtras() == null){
rec.setMedicamento(txtMedi.getText().toString());
rec.setDosagem(txtDos.getText().toString());
rec.setHorario(spn1.getSelectedItem().toString());
rec.setVencimento(txtDt.getText().toString());
rec.setdosradio(dosradio.toString());
bdhelper.insertRec(rec);
}
else{
rec.setMedicamento(txtMedi.getText().toString());
rec.setDosagem(txtDos.getText().toString());
rec.setHorario(spn1.getSelectedItem().toString());
rec.setVencimento(txtDt.getText().toString());
rec.setdosradio(dosradio.toString());
bdhelper.updateReceita(rec);
}
}
public void updateReceita(Receita rec)
{
db = getWritableDatabase();
ContentValues editContact = new ContentValues();
editContact.put("medicamento", rec.getMedicamento());
editContact.put("dosagem", rec.getDosagem());
editContact.put("dosradio", rec.getdosRadio());
editContact.put("horario", rec.getHorario());
editContact.put("venciment", rec.getVencimento());
db.update("tab", editContact, "_id=" + rec.getId(), null);
db.close();
} //
@Thiagorideraugusto his editions are not improving the understanding of the question (which by the way is not very clear by itself). For this reason I rejected your editions.
– user28595
Matheus, your question is a little confused, edit it explaining better the problem faced.
– user28595
Could add the method updateReceita ?? That’s where it’s not working, correct?
– Thiago Luiz Domacoski
ok edited the Question
– Matheus Matheus
problem solved...thanks
– Matheus Matheus