0
Method:
spnCondPagamento.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
List listaCondPagamento = new ArrayList<>();
for (int i = 0; i < condPagDao.getListaCondPagamento().size(); i++) {
listaCondPagamento.add(condPagDao.getListaCondPagamento().get(i).getDescricao());
listaIdCondPag.add(condPagDao.getListaCondPagamento().get(i).getId());
}
ArrayAdapter condPagAdapter = new ArrayAdapter<>(this, R.layout.support_simple_spinner_dropdown_item, listaCondPagamento);
condPagAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);
spnCondPagamento.setAdapter(condPagAdapter);
}
});
the problem is that it is showing a erro
:
Arrayadapter condPagAdapter = new Arrayadapter<>(this, R.layout.support_simple_spinner_dropdown_item, listCondPagamento);
of unchecked assignment being that if you sign it as Error string yet
Did you sign both left and right? (http://stackoverflow.com/a/4204999/520779)
– mgibsonbr
I think the problem is the use of
this
which in this case refers to the class/interface View.Onclicklistener who does not inherit from Context. Changethis
forNomeDaActivity.this
.– ramaral
You are inside a method that is being overwritten, try to exchange this for 'Minhaactivity.this' try to change the context briefly and let us think of something else to help you
– Alessandro Barreto
this will be the signature of Contexto, thanks to all! I switched this to Nomedaactivity.this
– lavaprato