I have a textfield for a filter customers action on a mobile device. I am wondering if I should wait for a few milliseconds before launching my code when the user typed in less then 3 chars, and only execute the code if the text is longer or equal than 3 chars.
The executed code takes longer(sql like syntax on a larger database), and the user sees hang-outs on the listview.
What do you think?
Delaying SQL queries on text changed events is a good idea indeed. We do use this technique throughout Android. We also always make sure to cancel any previous query. For instance, if the user types "ab", and we post a message to start a query after the user typed "a", we cancel that message when the user types "b".
If the user sees hang-outs when your code is launched, I wouldn't launch it right away.
Assuming the query executes on the fly based on the user's input, I would wait until you the user types enough chars to process a lighter query and wouldn't bog down the UI. Especially using %LIKE%
syntax, less char's you have to work with, means a larger query and a longer wait-time for the user.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With