Esempio n. 1
0
  /*Set data from database by select query*/
  public void GetEmail() {

    SQLiteDatabase db = myDb.getReadableDatabase();
    try {

      Cursor cursor =
          db.query(
              DbHelper.TABLE_NAME, new String[] {ID, EMAIL, NAME}, null, null, null, null, null);
      if (cursor.getCount() > 0) {
        cursor.moveToFirst();
        do {

          User_id = cursor.getString(0);
          user_Email = cursor.getString(1);
          user_Name = cursor.getString(2);
        } while (cursor.moveToNext());
        cursor.close();
        db.close();
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    onDestroy();
  }
Esempio n. 2
0
  // Close database class.
  public void onDestroy() {
    super.onDestroy();

    myDb.close();
  }