Skip to content

Instantly share code, notes, and snippets.

Created February 15, 2013 16:00
Show Gist options
  • Save anonymous/4961315 to your computer and use it in GitHub Desktop.
Save anonymous/4961315 to your computer and use it in GitHub Desktop.
Android InstantAutoComplete Text View
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.AutoCompleteTextView;
public class InstantAutoComplete extends AutoCompleteTextView {
public InstantAutoComplete(Context context) {
super(context);
}
public InstantAutoComplete(Context arg0, AttributeSet arg1) {
super(arg0, arg1);
}
public InstantAutoComplete(Context arg0, AttributeSet arg1, int arg2) {
super(arg0, arg1, arg2);
}
@Override
public boolean enoughToFilter() {
return true;
}
@Override
protected void onFocusChanged(boolean focused, int direction,
Rect previouslyFocusedRect) {
super.onFocusChanged(focused, direction, previouslyFocusedRect);
if (focused) {
performFiltering(getText(), 0);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment