package info.justaway.widget; import android.content.Context; import android.text.Editable; import android.util.AttributeSet; import android.widget.AutoCompleteTextView; public class AutoCompleteEditText extends AutoCompleteTextView { private int myThreshold; public AutoCompleteEditText(Context context) { super(context); } public AutoCompleteEditText(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public AutoCompleteEditText(Context context, AttributeSet attrs) { super(context, attrs); } @Override public void setThreshold(int threshold) { if (threshold < 0) { threshold = 0; } myThreshold = threshold; } @Override public boolean enoughToFilter() { return getText().length() >= myThreshold; } @Override public int getThreshold() { return myThreshold; } public String getString() { Editable editable = getText(); if (editable == null) { return ""; } String string = editable.toString(); if (string == null) { return ""; } return string; } }