private void clear() { watchers = false; nameText.removeTextChangedListener(nameWatcher); brandBox.removeTextChangedListener(brandWatcher); categoryBox.removeTextChangedListener(categoryWatcher); priceText.removeTextChangedListener(priceWatcher); sizeText.removeTextChangedListener(sizeWatcher); nameText.setText(""); sizeText.setText(""); priceText.setText(""); categoryBox.setText(""); brandBox.setText(""); }
private void setSendToAddressText(String addressStr) { // Remove listener before changing input, to avoid infinite recursion sendToAddressView.removeTextChangedListener(receivingAddressListener); sendToAddressView.setOnFocusChangeListener(null); sendToAddressView.setText(addressStr); sendToAddressView.addTextChangedListener(receivingAddressListener); sendToAddressView.setOnFocusChangeListener(receivingAddressListener); }
@Override public void updateView(final ViewDataBinding binding) { final TaskitemTextBinding b = (TaskitemTextBinding) binding; b.setTaskitem(this); final AutoCompleteTextView textview = (AutoCompleteTextView) b.taskitemDetailTextText; textview.setText(getValue()); if (mSuggestions != null && mSuggestions.size() > 0) { if (mSuggestionAdapter == null) { mSuggestionAdapter = new ArrayAdapter<>( textview.getContext(), android.R.layout.simple_dropdown_item_1line, mSuggestions); } textview.setAdapter(mSuggestionAdapter); } final Object tag = textview.getTag(); if (tag instanceof TextWatcher) { textview.removeTextChangedListener((TextWatcher) tag); } textview.addTextChangedListener(this); textview.setTag(this); }