I've been following a tutorial for working with SQL databases, I think I'm having issues with it because it has been written a while ago.
For example it had this.createDatabase which had to be replaced with this.openOrCreateDatabase, I found this with Google. There are other problems that I cannot find the solutions to: Query, Results, Next, setListAdapter all show errors.
Is this in fact the problem, that the tutorial has been created for an earlier SDK? Can someone please tell me where to go to see deprecated methods and their replacements or point out what I should be replacing the above with?
Apologies I'm just starting out with this, hopefully you understand what I mean. Help is very much appreciated.
EDIT: Tutorial is here: http://www.anddev.org/novice-tutorials-f8/working-with-the-sqlite-database-cursors-t319.html
The problems are in the code below, c.first, results.add, c.next, this.setListAdapter and most of the last line have errors
if (c.first()) {
int i = 0;
/* Loop through all Results */
do {
i++;
/* Retrieve the values of the Entry
* the Cursor is pointing to. */
String firstName = c.getString(firstNameColumn);
int age = c.getInt(ageColumn);
String ageColumName = c.getColumnName(ageColumn);
/* Add current Entry to results. */
results.add("" + i + ": " + firstName
+ " (" + ageColumName + ": " + age + ")");
} while (c.next());
}
}
} catch (FileNotFoundException e) {
} finally {
if (myDB != null)
myDB.close();
}
this.setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1_small, results));
} }