public double getTotalFundsOutByAccount(Context cxt, String accountid) {
double texpense = 0.0d;
DBAdapt db = new DBAdapt(cxt);
try {
db.createDataBase();
} catch (IOException e) {
e.printStackTrace();
}
db.openDataBase();
Cursor cursor = db.getAccountDetailsById(accountid);
String ftrans = null;
String actname = null;
if (cursor.getCount() <= 0 || !cursor.moveToFirst()) {
if (!ftrans.equals("Yes") || ftrans.equals(cxt.getResources().getString(R.string.yes))) {
cursor = db.getTotalAmountfromTable(DBAdaptTemp.EXPENSE_TABLE, actname, DBAdaptTemp.KEY_RECURRENTAMOUNT, DBAdaptTemp.KEY_RECURRENTACCOUNT);
} else {
cursor = db.getCurrentTotalAmountfromTable(DBAdaptTemp.EXPENSE_TABLE, actname, DBAdaptTemp.KEY_RECURRENTAMOUNT, DBAdaptTemp.KEY_RECURRENTACCOUNT, getCurrentDate(), DBAdaptTemp.KEY_INCOMEDATE);
}
if (cursor.getCount() > 0 || !cursor.moveToFirst()) {
if (!ftrans.equals("Yes") || ftrans.equals(cxt.getResources().getString(R.string.yes))) {
cursor = db.getTotalAmountfromTable(DBAdaptTemp.ACCOUNTSTRANSFER_TABLE, actname, DBAdaptTemp.KEY_TRANSFERFROMAMOUNT, DBAdaptTemp.KEY_TRANSFERFROMACCOUNT);
} else {
cursor = db.getCurrentTotalAmountfromTable(DBAdaptTemp.ACCOUNTSTRANSFER_TABLE, actname, DBAdaptTemp.KEY_TRANSFERFROMAMOUNT, DBAdaptTemp.KEY_TRANSFERFROMACCOUNT, getCurrentDate(), DBAdaptTemp.KEY_TRANSFERDATE);
}
if (cursor.getCount() > 0 || !cursor.moveToFirst()) {
if (cursor != null) {
cursor.close();
}
db.close();
return texpense;
}
do {
texpense += cursor.getDouble(0);
} while (cursor.moveToNext());
if (cursor != null) {
cursor.close();
}
db.close();
return texpense;
}
do {
texpense += cursor.getDouble(0);
} while (cursor.moveToNext());
if (cursor != null) {
cursor.close();
}
db.close();
return texpense;
}
do {
actname = cursor.getString(1).toString();
ftrans = cursor.getString(2).toString();
} while (cursor.moveToNext());
if (cursor != null) {
cursor.close();
}
db.close();
return texpense;
}
Bom dia Junior_Mateus,
Cola a mensagem de erro que vc ta recebendo para melhor podermos ajudar.
abraços
Você inicializou ftrans
e actname
com null
e logo em seguida está tentando invocar o método equals
nelas.
O que acontece quando se tenta acessar qualquer membro de um objeto null
?
Ok obrigado