X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fui%2Factivity%2FNewTransactionActivity.java;h=b7770dcc5310f2366ee9a0bb628392f989e8a42e;hp=b69710b3598c8c0d15d619e035e2fa8a930a49ef;hb=83cac114e375728080194fb09758b49c50a8119b;hpb=e975cffd3885678f30f69d09fbc99905c3118588 diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionActivity.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionActivity.java index b69710b3..b7770dcc 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionActivity.java @@ -483,7 +483,7 @@ public class NewTransactionActivity extends ProfileThemedActivity Log.d("descr selected", description); if (!inputStateIsInitial()) return; - try (Cursor c = MLDB.getReadableDatabase().rawQuery( + try (Cursor c = MLDB.getDatabase().rawQuery( "select profile, id from transactions where description=? order by date desc " + "limit 1", new String[]{description})) { @@ -491,20 +491,21 @@ public class NewTransactionActivity extends ProfileThemedActivity String profileUUID = c.getString(0); int transactionId = c.getInt(1); - List profiles = Data.profiles.getList(); - MobileLedgerProfile profile = null; - for (int i = 0; i < profiles.size(); i++) { - MobileLedgerProfile p = profiles.get(i); - if (p.getUuid().equals(profileUUID)) { - profile = p; - break; + LedgerTransaction tr; + MobileLedgerProfile profile = null; + for (int i = 0; i < Data.profiles.size(); i++) { + MobileLedgerProfile p = Data.profiles.get(i); + if (p.getUuid().equals(profileUUID)) { + profile = p; + break; } } - if (profile == null) throw new RuntimeException(String.format( - "Unable to find profile %s, which is supposed to contain " + - "transaction %d with description %s", profileUUID, transactionId, description)); + if (profile == null) throw new RuntimeException(String.format( + "Unable to find profile %s, which is supposed to contain " + + "transaction %d with description %s", profileUUID, transactionId, + description)); - LedgerTransaction tr = profile.loadTransaction(transactionId); + tr = profile.loadTransaction(transactionId); int i = 0; table = findViewById(R.id.new_transaction_accounts_table); ArrayList accounts = tr.getAccounts();