Reputation: 11050
When I press on a ListView item, my app makes a call to server. If, while that call is being made, somebody presses in another item, it makes another call that often crashes my app.
I don't want the UI to lag either, and I want the ListView to be able to scroll. I just don't want it to react to any click events.
My calls have a callback, so if there's a way to do this smoothly I'd just enable it on item click and then disable it when the callback gets called.
Is there any way to achieve this?
Upvotes: 0
Views: 288
Reputation: 1286
Just make a check with boolean variable on your listview click. You can use boolean variable to set false when you click on ListView and when you gets callback you can make it true again.
Upvotes: 0
Reputation: 14274
I think you're trying to fix the wrong problem. You shouldn't disable ListView clicks while your operation runs, but rather queue the operation or disable it while another is running. The latter should be relatively simple with a static boolean semaphore.
Upvotes: 4