Created
February 15, 2013 16:00
-
-
Save anonymous/4961315 to your computer and use it in GitHub Desktop.
Android InstantAutoComplete Text View
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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