java - Filter Method in searchView Widget for android scala eclipse plugin -
i used searchview widget in android, eclipse scala plugin, want update list after pressing search button, right-now have error in filter method implementation
would please give me hints,
here filter method:
override def getfilter(): filter = { new filter() { protected override def publishresults(constraint: charsequence, results: filterresults) { books = results.values.asinstanceof[list[bookmetadata]] itemadapter.this.notifydatasetchanged() } protected override def performfiltering(constraint: charsequence): filterresults = { val filteredresults: list[bookmetadata] = listbuffer(books.asscala.tolist.filter(b.startswith(constraint.tostring)): _*) val results = new filterresults() results.values = filteredresults results } } }
i have error here :
books = results.values.asinstanceof[list[bookmetadata]]
error: multiple markers @ line - reassignment val - reassignment val
one error b. val filteredresults: list[bookmetadata] =
listbuffer(books.asscala.tolist.filter(b.startswith(constraint.tostring)): _*)
not found: value b
thanks in advance!
change
val books
to
var books
and change
val filteredresults: list[bookmetadata] = listbuffer(books.asscala.tolist.filter(b.startswith(constraint.tostring)): _*)
to
val filteredresults: list[bookmetadata] = listbuffer(books.asscala.tolist.filter(b => b.startswith(constraint.tostring)): _*)
and please see use of def, val, , var in scala
Comments
Post a Comment