+ TextView empty_amount = null;
+ boolean single_empty_amount = false;
+ boolean single_empty_amount_has_account = false;
+ float running_total = 0f;
+ boolean have_description =
+ !((TextView) findViewById(R.id.new_transaction_description)).getText().toString()
+ .isEmpty();
+
+ try {
+ for (int i = 0; i < table.getChildCount(); i++) {
+ TableRow row = (TableRow) table.getChildAt(i);
+
+ TextView acc_name_v = (TextView) row.getChildAt(0);
+ TextView amount_v = (TextView) row.getChildAt(1);
+ String amt = String.valueOf(amount_v.getText());
+ String acc_name = String.valueOf(acc_name_v.getText());
+ acc_name = acc_name.trim();
+
+ if (!acc_name.isEmpty()) {
+ accounts++;
+
+ if (!amt.isEmpty()) {
+ accounts_with_values++;
+ }
+ }
+ else empty_rows++;
+
+ if (amt.isEmpty()) {
+ amount_v.setHint(String.format("%1.2f", 0f));
+ if (empty_amount == null) {
+ empty_amount = amount_v;
+ single_empty_amount = true;
+ single_empty_amount_has_account = !acc_name.isEmpty();
+ }
+ else if (!acc_name.isEmpty()) single_empty_amount = false;
+ }
+ else {
+ amounts++;
+ if (!acc_name.isEmpty()) amounts_with_accounts++;
+ running_total += Float.valueOf(amt);
+ }
+ }