The structure of DB Dictionary includes two columns: KEY and VALUE. When I press a key, it takes about 2s to finish finding suggestion keywords for my dictionary. But if a user presses 5 words continuous, what will happen. If I press a key, after that my queries is executed, but it causes my Virtual keyboard to crash, cannot add a new key press until the query is completed. If I used UI thread, it will cause deadlock. Can anyone help me in this matter?
UPDATE: I combine the two methods: index and Thread with queues. I add a new word when press a key with queues. I query the order from the queue and delete its value in front of the queue. when the user press a key repeatedly, it will query the last element of the queue. And i used keyword synchronized to avoid errors cursor index out of bounds "index -1 requested: with size 1024" with multithread