Source:
public RegistrationSelectView(RegistrationFormField field, View view) { this.mField = field; this.mView = view; this.mTextInputLayout = (TextInputLayout) view.findViewById(R.id.input_wrapper_auto_complete); this.mInputView = (RegistrationOptionAutoCompleteTextView) view.findViewById(R.id.input_auto_complete); this.mInstructionsView = (TextView) view.findViewById(R.id.input_auto_complete_instructions); this.mErrorView = (TextView) view.findViewById(R.id.input_auto_complete_error); for (RegistrationOption option : mField.getOptions()) { if (option.isDefaultValue()) { mField.getOptions().remove(option); break; } } mTextInputLayout.setHint(mField.getLabel()); mInputView.setItems(mField.getOptions()); setInstructions(field.getInstructions()); mErrorView.setVisibility(View.GONE); mInputView.setTag(mField.getName()); mInputView.setContentDescription(String.format("%s. %s.", mInputView.getSelectedItemName(), mField.getInstructions())); ViewCompat.setImportantForAccessibility(mInstructionsView, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO); mInputView.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if (!mInputView.hasValue(s.toString().trim())) { mInputView.setSelectedItem(null); } if (hasFocusLost) { isValidInput(); } } @Override public void afterTextChanged(Editable s) { } }); mInputView.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { mInputView.showDropDown(); } else { hasFocusLost = true; } } }); }

Target:
public RegistrationSelectView(RegistrationFormField field, View view) { this.mField = field; this.mView = view; this.mTextInputLayout = (TextInputLayout) view.findViewById(R.id.input_wrapper_auto_complete); this.mInputView = (RegistrationOptionAutoCompleteTextView) view.findViewById(R.id.input_auto_complete); this.mInstructionsView = (TextView) view.findViewById(R.id.input_auto_complete_instructions); this.mErrorView = (TextView) view.findViewById(R.id.input_auto_complete_error); for (RegistrationOption option : mField.getOptions()) { if (option.isDefaultValue()) { mField.getOptions().remove(option); break; } } mTextInputLayout.setHint(mField.getLabel()); mInputView.setItems(mField.getOptions()); setInstructions(field.getInstructions()); mErrorView.setVisibility(View.GONE); mInputView.setTag(mField.getName()); mInputView.setContentDescription(String.format("%s. %s.", mInputView.getSelectedItemName(), mField.getInstructions())); ViewCompat.setImportantForAccessibility(mInstructionsView, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO); mInputView.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if (!mInputView.hasValue(s.toString().trim())) { mInputView.setSelectedItem(null); } if (hasFocusLost) { isValidInput(); } } @Override public void afterTextChanged(Editable s) { } }); mInputView.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { mInputView.showDropDown(); } else { hasFocusLost = true; isValidInput(); } } }); }