It may seem a silly question but I've tried a variety of ways and have no idea how to solve. I am new to android programming and am completing a spinner with a list of objects. When you select the object in need spinner pick up the object ID and the number of animals of the same. My last attempt was is, but I know he does not enter the IF because the equals can not compare the list with a string, but do not know how to make this comparison.
String posicaoSpinner = String.valueOf(sLote.getSelectedItemPosition());
int idLote =0;
int qtdAnimais;
for (int i = 0; i < loteList.size(); i++) {
for (Lote lotes : loteList) {
if (posicaoSpinner.equals(loteList.get(i))) {
idLote = Integer.valueOf(String.valueOf(lotes.get_id()));
qtdAnimais = lotes.getQtd_animais() - itemPovoamento.getAnimais();
lotes.setQtd_animais(qtdAnimais);
}
}
}
Any help is welcome. Thank you so much