Method getOneContact
Method getOneContact
(Fig. 8.56) also uses SqLiteDatabase
’s query
method to query the database. In this case, we retrieve all the columns in the database for the contact with the specified ID.
87 // return a Cursor containing specified contact's information88 public Cursor getOneContact(long id)89 {90 return database.query(91 "contacts", null, "_id=" + id, null, null, null, null);92 }93
Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.