• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

How do you set text and trigger onItemClick() of an autoCompleteTextView?

Code:
 autoCompleteTextViewFreqFunction.setText(function);

            autoCompleteTextViewFreqFunction.performCompletion();
This successfully selects the text I want.

The problem is, I have some code that needs to be run after an item is selected and I am unsure how to go about it.

I can call code when an item is clicked, but not with performCompletion(). Id there a way to listen to that?
Code:
        autoCompleteTextViewFreqFunction.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                if(arrayAdapterFreq.getItem(i).toString().contentEquals(getResources().getString(R.string.Constant)))
                    // setUp GUI
                }
            }
        });
        textInputLayoutFreqFunction.requestFocus();
    }

I could call onItemClick() explicitly, but how do I get the id of the text that was set?
 
Back
Top Bottom