Hello any help would be great thank you! i have 3 fields in my database table
public static final String colExpID = "ExpenseID";
public static final String colExpExpense = "ExpenseDisc";
public static final String colExpAmount = "Amount";
My method to query data
public Integer[] queryHouse() {
// TODO Auto-generated method stub
String[] columns = new String[]{colExpID,colExpExpense,colExpAmount};
Integer[] Result = new Integer[]{};
Cursor c = ourDatabase.query(ExpenseTable, columns, null, null, null, null, null);
int iExpense = c.getColumnIndex(colExpExpense);
int iAmount = c.getColumnIndex(colExpAmount);
for(int i = 0; i < c.getCount();i++){
if(c.getString(iExpense) == "House"){
Result[i] = Integer.parseInt(c.getString(iAmount));
}
}
return Result;
}
I'm not sure what i'm missing thank you!