I have a question, since I'm setting the image from the Spinner position. Then, when you open the activity, the OnCreate method will read the position of the spinner and load the image according to its type.
However, I would like to know how to set the Spinner position whenever the user clicks on the spinner and changes position.
teste = arrayLitros.get(spnProdutos.getSelectedItemPosition()).toString();
teste2 = arrayUnidadeL.get(spnProdutos.getSelectedItemPosition()).toString();
if(teste.equals("20") && teste2.equals("L")){
imgProduto.setImageResource(R.drawable.img1);
}
else if(teste.equals("10") && teste2.equals("L")){
imgProduto.setImageResource(R.drawable.img2);
}
else if(teste.equals("2") && teste2.equals("L")){
imgProduto.setImageResource(R.drawable.img3);
}
else if(teste.equals("3") && teste2.equals("M")){
imgProduto.setImageResource(R.drawable.img4);
}