Hi everyone,
I'm new to StackOverflow but so far I love this site. I'm writing an Android application for RC cars. It uses an SQLite Database, and saves the model of the car (carname) as well as other variables.
I want to be able to display only the records that have a certain model of car named in the carname column. So far I can only filter the results by using "'MTX-4'" or some other literal string. I need to be able to replace that with a string variable like String carName or something, so I can filter by a user-defined carname.
Here's my code:
public Cursor fetchAllNotes() {
return mDb.query(DATABASE_TABLE, new String[] {KEY_ROWID, KEY_TITLE,
KEY_CARNAME, KEY_TRACKNAME, KEY_TRACKSIZE, KEY_TRACKTRACTION, KEY_TRACKSURFACE, KEY_BODYTYPE, KEY_COMMENTS}, KEY_CARNAME + "=" + "'MTX-4'", null, null, null, null);
}
Any help and comments warmly appreciated.
Cheers!