Android Question Autocomplete Edit Text or Searchview sql query and repopulate on textchanged (solved)

royalke

Member
Licensed User
Longtime User
Hi guys, I'm new here... i've been hunting desperately through the boards and can't find and answer to my question:

I want to constantly be querying the db on textchanged events in acet or sv. I've got a sqlite db, with over 60k records. Obviously I can't load them all into the lists for autocomplete edittext or searchview (i tried just in case)

ACET -> mylist.clear on TEXTCHANGED will yield a crash if anyone picks anything (obviously because there's no longer a record in the array

SV -> SV will work when I modified it to querydb on TEXTCHANGE, but it is so slow ~ 4000ms per query (i limited the query to 5)

I think I should continue with the searchview because it's so powerful but it is too slow for the index building, is there something I can do about this to make it more usable?
 

royalke

Member
Licensed User
Longtime User
In the end I chose Searchview but modified it,
  • rather than preloading the data in an index and let ex_changed refer to the list
  • i removed those references and trigger an sql query on ex_changed
  • then fill a global list (mylist) with the sql results
  • finally i removed requirements and use of additems (prefix, suffix) and just use it to populate the listview with mylist (list)
i let sql drive the searches, to save time i used "select field from table limit 5" (for example), the results are nearly instantaneous and there's no index build time.

essentially i'm using none of the great uses of searchview and instead using a listview inside an edittext, it works great!
 
Upvote 0
Top