In my android app there is a relatively long running AsyncTask I'm running to update the database when the app starts up. I'm needing to wrap that in a transaction to roll things back if the user exits the app before the task is finished. However since wrapping the code in a transaction it is blocking the ui untill the task is complete. Why would this be since the code is already running in a separate thread?
I'm using ORMLite and this is the wrapper for the transaction basically,the code to update the db goes inside call().., before adding the code to update the db inside a transaction there was no locking of the ui...
public ConnectionSource source;
@Override
protected Boolean doInBackground(Context... params) {
try {
TransactionManager.callInTransaction(source, new Callable<Void>() {
public Void call() throws Exception {
return null;
}
});