Here in my app I create a dialog box which contain an autocomplete view. In the autoComplete view I want it to pop down the suggestions.when I enter names. But the problem is that it gives only 2 suggestions.
Here is the code for my autocomplete view in the XML file
<com.example.netmdapp1.CustomAutoCompleteTextView
android:id="@+id/customautocomplete"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:completionThreshold="3"
android:scrollbars="vertical" />
And here is my CustomAutoCompleteTextView class
public class CustomAutoCompleteTextView extends AutoCompleteTextView {
HashMap<String, String>hm;
public CustomAutoCompleteTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected CharSequence convertSelectionToString(Object selectedItem) {
hm = (HashMap<String, String>)selectedItem;
return hm.get("name");
}
public String getid() {
return hm.get("id");
}
}
And the code for set adapter to my autocomplete textView is given below
final CustomAutoCompleteTextView autoComplete = new CustomAutoCompleteTextView(getParent(), null);
SimpleAdapter adapter = new SimpleAdapter(getParent(), patientList, R.layout.autocomplete_texts, from, to);
I think you should have to look at this:
android-immediate-auto-complete
It will help you.
Feel free to comment.