Hey i'm a noob and i know this sounds simple but i have no idea how to do it. How do you use a pre-implemented method getWord?
// Getting single word
public DatabaseDictionary getWord(int id) {
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(TABLE_DICTIONARY, new String[] { COLUMN_ID,
COLUMN_ENGLISH, COLUMN_OTHER, COLUMN_TERM }, COLUMN_ID + "=?",
new String[] { String.valueOf(id) }, null, null, null, null);
if (cursor != null)
cursor.moveToFirst();
DatabaseDictionary word = newDatabaseDictionary(Integer.parseInt(cursor.getString(0)),
cursor.getString(1), cursor.getString(2), cursor.getString(3));
// return word
return word;
}
I know i have to write
final DatabaseHandler db = new DatabaseHandler(this);
db.getWord(1);
But how do i assign this a variable i can use? I've tried this...
String word = db.getWord(1);
And that doesn't work. Please help. Thankyou
0 comments:
Post a Comment