I am trying to build a query method in my database helper class that will return a Cursor for a user-specified string. I have the string being passed into the ListActivity successfully. (I have a toast message that uses the bundled string, so I know that works.) So, I have the method like this:
public Cursor findByTitle(String title) throws SQLException {
//define cursor to return and execute database query
Cursor mCursor =
mDb.query(DATABASE_TABLE, KEY_PROTEIN, selection, selectionArgs, groupBy, having, orderBy)
while (mCursor != null) {
mCursor.moveToFirst();
return mCursor;
}
}
I think my main problem is I can not find a clear example of the SQLite syntax for the selection, selectionArgs, etc. I simply don't know how to input those into the method. The database table has row id, title, protein, and notes for columns and I want the query to go over the entire database and pull every row that contains the user's string. Then I want to create a method that will take the cursor's information and display the title of row that held the user's string. Any help would be greatly appreciated. I am pretty new to this, but I really want to learn how it works.

New Topic/Question
Reply



MultiQuote





|