import android.database.sqlite.SQLiteDatabase;
import net.ktnx.mobileledger.model.LedgerTransaction;
+import net.ktnx.mobileledger.model.LedgerTransactionItem;
import net.ktnx.mobileledger.utils.MobileLedgerDatabase;
import java.util.ArrayList;
LedgerTransaction tr =
new LedgerTransaction(cursor.getString(0), cursor.getString(1),
cursor.getString(2));
- // TODO: fill accounts and amounts
+ try (Cursor cAcc = db.rawQuery("SELECT account_name, amount, currency FROM " +
+ "transaction_accounts WHERE transaction_id = ?",
+ new String[]{tr.getId()}))
+ {
+ while (cAcc.moveToNext()) {
+ tr.add_item(
+ new LedgerTransactionItem(cAcc.getString(0), cAcc.getFloat(1),
+ cAcc.getString(2)));
+ }
+ }
transactions.add(tr);
}
}