]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java
beginTransaction should be outside the try{} block
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / async / RetrieveTransactionsTask.java
index dc73944332b728ccae78e798089fa71c11d9a35c..f9297f0089e28542ba8c60c2f29feba6da6ed57f 100644 (file)
@@ -159,7 +159,13 @@ public class RetrieveTransactionsTask
                                 if (line.equals("<h2>General Journal</h2>")) {
                                     state = ParserState.EXPECTING_TRANSACTION;
                                     L("→ expecting transaction");
+                                    // commit the current transaction and start a new one
+                                    // the account list in the UI should reflect the (committed)
+                                    // state of the database
+                                    db.setTransactionSuccessful();
+                                    db.endTransaction();
                                     Data.accounts.set(accountList);
+                                    db.beginTransaction();
                                     continue;
                                 }
                                 m = reAccountName.matcher(line);
@@ -432,7 +438,6 @@ public class RetrieveTransactionsTask
                 db.endTransaction();
             }
         }
-
         return true;
     }
     private boolean retrieveTransactionList(MobileLedgerProfile profile)