import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.AsyncTask;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.AsyncTask;
import net.ktnx.mobileledger.model.Data;
import net.ktnx.mobileledger.model.LedgerAccount;
import net.ktnx.mobileledger.model.MobileLedgerProfile;
import net.ktnx.mobileledger.model.Data;
import net.ktnx.mobileledger.model.LedgerAccount;
import net.ktnx.mobileledger.model.MobileLedgerProfile;
public class UpdateAccountsTask extends AsyncTask<Void, Void, ArrayList<LedgerAccount>> {
protected ArrayList<LedgerAccount> doInBackground(Void... params) {
public class UpdateAccountsTask extends AsyncTask<Void, Void, ArrayList<LedgerAccount>> {
protected ArrayList<LedgerAccount> doInBackground(Void... params) {
ArrayList<LedgerAccount> newList = new ArrayList<>();
String sql = "SELECT a.name from accounts a WHERE a.profile = ?";
ArrayList<LedgerAccount> newList = new ArrayList<>();
String sql = "SELECT a.name from accounts a WHERE a.profile = ?";
try (Cursor cursor = db.rawQuery(sql, new String[]{profileUUID})) {
while (cursor.moveToNext()) {
final String accName = cursor.getString(0);
try (Cursor cursor = db.rawQuery(sql, new String[]{profileUUID})) {
while (cursor.moveToNext()) {
final String accName = cursor.getString(0);
// String.format("Read account '%s' from DB [%s]", accName, profileUUID));
LedgerAccount acc = profile.loadAccount(db, accName);
if (acc.isVisible(newList)) newList.add(acc);
// String.format("Read account '%s' from DB [%s]", accName, profileUUID));
LedgerAccount acc = profile.loadAccount(db, accName);
if (acc.isVisible(newList)) newList.add(acc);
- Log.d("UAT", "decrementing background task count");
- Data.backgroundTaskCount.decrementAndGet();
+ debug("UAT", "decrementing background task count");
+ Data.backgroundTaskFinished();