Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. public Book findOne(String find) {
  2.         SQLiteDatabase db = this.getReadableDatabase();
  3.         Cursor cursor = db.query(TABLE_NAME, new String[]{KEY_NUMBER,
  4.                         KEY_JUDUL, KEY_NOTASI, KEY_TEMA}, KEY_NUMBER + "=?",
  5.                 new String[]{find}, null, null, null, "1");
  6.         if (cursor.moveToFirst()) {
  7.             do {
  8.                 Book buku = new Book(cursor.getString(0), cursor.getString(1), cursor.getString(2), cursor.getString(3));
  9.                 return buku;
  10.             }while (cursor.moveToNext());
  11.         }
  12.         cursor.close();
  13.         db.close();
  14.         return null;
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement