I have a TextInputLayout with style ExposedDropdownMenu. this TextInputLayout contains an AutoCompleteTextView. I can add a list item inside this AutoCompleteTextView using an adapter.
mLightSensorGainTextInput = (AutoCompleteTextView) findViewById(R.id.paramLightSensorGain);
String[] gainStrArray = new String[] {"1", "2"};
ArrayAdapter<String> gainAdapter = new ArrayAdapter<>(this, R.layout.version_list_item, gainStrArray);
mLightSensorGainTextInput.setAdapter(gainAdapter);
I would like to set one value displayed when I click a "setDefaultButton" but I have always the initial view:
I tried :
mLightSensorGainTextInput.setListSelection(0);
mLightSensorGainTextInput.setSelection(0);
but none of the 2 methods shows the value expected which is : 1. Do you have any suggestion? Best regards Mich
Please here is more informations about what I expect. Only last operation (default button) does not work.
The solution is to use the filter:
mLightSensorGainTextInput.setText("1", false);