0
I need to take the position of the item of an autoCompleteTextView and pass the data to other fields. So far my code is like this:
spinner_produtos.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override public void onItemClick(AdapterView<?> parent, View arg1, int pos, long id)
{
//etCodigo_produto.setText(lista_produtos.getItem(position).getCodigo_produto().toString());
codigo_produto = lista_produtos.getItem(pos).getCodigo_produto();
But there is no item selected. If anyone can help, thank you.
You need the selected value or position of the selected item in your spinner ?
– Gabriel Henrique
Item position, however is not a spinner, only the nomenclature this spinner, is an autoCompleteTextView
– Leandro Santos
Leandro, try using the following function int position = youTextView.getSelectedItemPosition();
– Gabriel Henrique
I tried something like this but it didn’t work int position = autoCompleteTextView_products.getSelectedItemPosition();
– Leandro Santos