Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable click event for certain elements in AutoCompleteTextView

I am using AutoCompleteTextView (ref : AutoCompleteTextView )

I am able to get list of auto suggestion provided by this view.

Now I want to disable the second suggestion from this view.

Can you please tell me how to achieve it ? Thanks

like image 396
Pratik Avatar asked Oct 04 '22 06:10

Pratik


1 Answers

Create a custom data adapter for your AutoCompleteTextView by extending ArrayAdapter and then override isEnabled method from that custom adapter to define which items are click-able or not.

@Override
public boolean isEnabled(int position) {
    // TODO Auto-generated method stub
    return super.isEnabled(position);
}
like image 59
waqaslam Avatar answered Oct 10 '22 03:10

waqaslam