I have looked at the forum but cant find any assistance with this previously
- Might be useful to others
I was looking for a way to run an autocompletetextbox with a filter which
allowed the selection from teh adapter to show any items 'containing' the
letters typed in (by default it will filter on anything 'beginning' with the
letters typed in )
I came across an item on StackOverflow with this Java code
I have successfully converted java code before but htis one beats me -Can
anyone help - Like I say this might be a useful example to add to the Webote
or one of the books to help others - I'm just not knowledgeable enough to
solve it
This code is my attempt at conversion but throws up several errors which I
cant figure
I realise that even if I get this translated into c# I still have to figure
how to filter on a 'contains' model rather than 'begin wth'
Any help much appreciated
John Murray
Agar14.ACAdapter.SuggestionsFilter' does not implement inherited abstract
member 'Android.Widget.Filter.PerformFiltering(Java.Lang.ICharSequence)'
'Agar14.ACAdapter.SuggestionsFilter.PerformFiltering(Android.Runtime.CharSeq
uence)': no suitable method found to override
'Agar14.ACAdapter.SuggestionsFilter.PublishResults(Android.Runtime.CharSeque
nce, Android.Widget.Filter.FilterResults)': no suitable method found to
override
Cannot access a non-static member of outer type 'Android.Widget.BaseAdapter'
via nested type 'Agar14.ACAdapter.SuggestionsFilter'
'Android.Runtime.CharSequence': static types cannot be used as parameters
public class ACAdapter : ArrayAdapter , IFilterable
{
protected LayoutInflater mInflater;
protected Filter filter;
public ACAdapter(Context context, int textViewResourceId, string[]
items) :base(context, textViewResourceId, items)
{
SuggestionsFilter filter = new SuggestionsFilter();
mInflater = LayoutInflater.From(context);
}
public override View GetView(int position, View convertView, ViewGroup
parent) {
View v = convertView;
if (v == null) {
v = mInflater.Inflate(Resource.Layout.list_item, parent, false);
}
TextView tt = v.FindViewById<TextView>(Resource.Layout.textview);
tt.SetText("Suggestion item",TextView.BufferType.Editable);
return v;
}
public Filter GetFilter() {
return filter;
}
public class SuggestionsFilter : Filter {
protected override FilterResults PerformFiltering(CharSequence
constraint) {
return null;
}
protected override void PublishResults(CharSequence constraint,
FilterResults results) {
NotifyDataSetChanged();
}
}
}
_______________________________________________
Monodroid mailing list
[email protected]
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid