Do you know how can I get the view which triggered an event?
By example:
final AutoCompleteTextView edtxInput = (AutoCompleteTextView)layout.findViewById(R.id.edtx_input);
edtxInput.setThreshold(2);
edtxInput.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View arg1, int position, long arg3) {
Console.debug(TAG, "view: " + arg1, Console.Liviu);
edtxInput.setText(((FormOption)edtxInput.getAdapter().getItem(position)).getDescription());
}
});
The problem here is that I don’t know how I can update the text from edtxInput in OnItemClickListener without making it final.
Thanks
Check this http://developer.android.com/reference/android/widget/AdapterView.OnItemClickListener.html
arg1 is the AutoCompleteTextView (edtxInput) itself. so you can do
UPDATE
Seems like the
AutoCompleteTextViewis not a subclass of AdapterView. That is at some part "fault" of the SDK here. To get theAutoCompleteTextViewyou can do a hackSo you get the clicked view then get its parent that is the
AutoCompleteTextViewBut why you don’t want
AutoCompleteTextViewto be final in the first place? Any particular reason?If you want only the adapter you can write this and only this