Android AsyncTask - avoid multiple instances running -



Android AsyncTask - avoid multiple instances running -

i have asynctask processes background http stuff. asynctask runs on schedule (alarms/service) , sometime user executes manually.

i process records sqlite , noticed double-posts on server tells me sometime scheduled task runs , @ same time user runs manually causing same record read , processed db twice. remove records after processed still this.

how should handle ? maybe organize kind of queing?

you can execute asynctask's on executor using executeonexecutor()

to create sure threads running in serial fashion please use: serial_executor.

misc: how utilize executor

if several activities accessing db why don't create sort of gateway database helper , utilize synchronized block ensure 1 thread has access @ instant

android

Comments

Popular posts from this blog

java - How to pass parameters between Request-Scoped Controllers? -

actionscript 3 - Flex: moving a point with rotation doesnt change the point XY? -

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? -