Hi I am having this problem with my database, my database is called DatabaseClass
. The database basically stores my information for bank's name, account number of customer and the balance.I have two spinners in one of my activities which shows me the bank and the account number for the particular bank selected. On selecting one of the banks, the corresponding account numbers for that bank in the other spinner are displayed, till this its working fine, now when an 'account number' is selected I am trying to retrieve the balance in that account
Here's the code I am using:
account_for_spiiner_account=cursor2.getString(cursor2.getColumnIndex(DatabaseClass.KEY_ACCOUNT_NUMBER_ID));
c= myDatabase.getAmountfor_Account(account_for_spiiner_account);
And here's the code for getting the amount for that particular account number:
public Cursor getAmountfor_Account(String account_for_spiiner_account) {
// TODO Auto-generated method stub
return myDataBase.query(DATABASE_TABLE_ACCOUNT, new String[] {
DatabaseClass.KEY_ROW_ID, DatabaseClass.KEY_ACCOUNT_NUMBER_ID,
DatabaseClass.KEY_AMOUNT_ID }, KEY_ACCOUNT_NUMBER_ID + "=?",
new String[] { account_for_spiiner_account }, null,null,null);
}
I am trying to collect the amount as a String
in a variable and to check the amount got I made a Toast
. But the toast is showing nothing as such, any idea where I am getting wrong? Thanks.