I'm trying to get an AutoCompleteTextView's ID after I clicked a value on the list. Tried looking up on google and stackoverflow, but the provided answers didn't work. Here's what I've got:

Created the view in my class declaration:

```
public class ActivityCadastrarCliente extends Activity implements OnClickListener, OnItemClickListener {
    AutoCompleteTextView E_Nome_Cliente, E_CPF;
    List<String> Nomes = new ArrayList<String>();
    ...

```

Associated the view to an XML element:

```
E_Nome_Cliente = (AutoCompleteTextView)findViewById(R.id.Nome_Cliente);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, Nomes.toArray(new String[0]));
E_Nome_Cliente.setAdapter(adapter);
E_Nome_Cliente.setOnItemClickListener(this);

```

and my onItemClick method is called normally as below:

```
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    //switch (parent.getId()) { 
        //case R.id.Nome_Cliente:
            ...

    //}
}

```

Does anybody know how I can access this view inside onItemClick? Tried several ways, but I only get exceptions:

```
//Class cast exception
AutoCompleteTextView input = (AutoCompleteTextView)view.getParent();
//Class cast exception
AutoCompleteTextView input = (AutoCompleteTextView)parent;
//Class cast exception
AutoCompleteTextView input = (AutoCompleteTextView)parent.getParent();

```

I need to identify which view was clicked, because I'm using 3 to 5 AutoCompleteTextView and based on the selected value I'll automatically fill in a bunch of other fields.