I have a list of titles i want to display to the main activity so that each time the user starts the app, they can select an option from the data they gave previously. My problem is converting the cursor to array successfully so that i can maintain the ids for each title.Here is my code:
public DbFunc open() throws SQLException{
ourHelper = new DbHelper(ourContext);
ourDatabase = ourHelper.getWritableDatabase();
return this;
}
public void close(){
ourHelper.close();
}
public long createBudget(String Title, String Amount){
ContentValues cv = new ContentValues();
cv.put(BUDGET_TITLE, Title);
cv.put(BUDGET_AMOUNT, Amount);
return ourDatabase.insert(BUDGET_LIST_TABLE, null, cv);
}
public Cursor getBudgetTitles() throws SQLException{
String[] columns = {BUDGET_TITLE};
Cursor c = ourDatabase.query(BUDGET_LIST_TABLE, columns, null, null, null, null, BUDGET_TITLE);
/** Problem is here. I want to return an array for the listview */
return c;
}