My project is simple, a grid view, with several buttons, and in the click of them opens a popup with 3 options and in the click of them, arrows a text and a background in the button, but when I leave the activity and enter them, no are there, wanted a help with database, to save it.
botaoDoGridView.setOnClickListener(new View.OnClickListener() {@Override
public void onClick(View v) {
final PopupMenu pn = new PopupMenu(CalendarActivity.this, bt11);
pn.getMenuInflater().inflate(R.menu.popup_menu, pn.getMenu());
pn.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.primeiro:
bt11.setText("HIDRATAR");
bt11.setBackground(getDrawable(R.drawable.fundohidra));
return true;
case R.id.segundo:
bt11.setText("NUTRIÇÃO");
bt11.setBackground(getDrawable(R.drawable.fundonutri));
return true;
case R.id.terceiro:
bt11.setText("RECONS");
bt11.setBackground(getDrawable(R.drawable.fundorecon));
return true;
case R.id.quarto:
bt11.setBackground(getDrawable(R.drawable.desligar));
Toast.makeText(CalendarActivity.this, "Etapa Finalizada,Aguarde entre 48 a 72 horas para ir pra proxima Etapa", Toast.LENGTH_LONG).show();
return true;
}
return true;
}
});
pn.show();
}
});