Whenever I click on the Toolbar I have a menu that when I click on one of the options I get a AlertDialog
. This AlertDialog has a setSingleChoiceItems
, in which the user when choosing an option and clicking OK, this option is saved in the DB.
All of this works well. The problem is that when I go back to the activity I want different information to appear depending on the user's choice in AlertDialog and I'm not getting it.
I'm using OnResume ()
mes = (TextView) findViewById(R.id.textMes);
metaDef = (TextView) findViewById(R.id.textMetaDef);
despesa = (TextView) findViewById(R.id.textDesp);
if (db_helper.hasMoeda()) {
moeda = db_helper.getMoeda();
} else {
db_helper.updateMoeda("Euro");
}
Gasto gasto=new Gasto();
gasto=db_helper.getGasto();
mes.setText(gasto.getMes());
if (moeda.equalsIgnoreCase("Euro")) {
metaDef.setText("" + gasto.getMeta() + " €");
despesa.setText(String.format("%.2f €", gasto.getDespesa_final()));
} else if (moeda.equalsIgnoreCase("Real")) {
metaDef.setText("R$ " + gasto.getMeta());
despesa.setText(String.format("R$ %.2f", gasto.getDespesa_final()));
}
What is happening is that the activity does not update when I click on alertDialog OK. Anyone have any suggestions?