Say I want to implement some fast searching. User enter some letters and and everytime the letter changes then my program will search the net to give search suggestions.
However, I do not want that function to be called more often than 3 seconds.
How would I do so?
I currently use a timer. Also the “search” the net for auto complete will be done on background so some multithreading issue will show up.
I’ll post codes soon. But most answers are similar with mine.
Oh ya, the complexity is that if users type too fast the grabbing should still be done after 3 seconds. So not right away but still be done.
You can create timer and check updates of your search string. Smth like
then just implement update method
just don’t forget too invalidate your timer when you do not need it