Exemplo n.º 1
0
  public List<Wifi_class> getAllWifi() {
    List<Wifi_class> contactList = new ArrayList<Wifi_class>();
    // Select All Query
    String selectQuery = "SELECT  * FROM wifi_table ;";

    SQLiteDatabase db = this.getWritableDatabase();
    Cursor cursor = db.rawQuery(selectQuery, null);

    // looping through all rows and adding to list
    if (cursor.moveToFirst()) {
      do {
        Wifi_class contact = new Wifi_class();
        contact.setId(Integer.parseInt(cursor.getString(0)));
        contact.setDestination(cursor.getString(1));
        contact.setDetails(cursor.getString(2));
        contact.setTime(cursor.getString(3));

        // Adding contact to list
        contactList.add(contact);
      } while (cursor.moveToNext());
    }
    // db.delete("score",null,null);
    db.close();
    // return contact list
    return contactList;
  }
Exemplo n.º 2
0
  private void insertWifi(Wifi_class s, SQLiteDatabase database) {
    ContentValues values = new ContentValues();
    values.put("destination", s.getDestination());
    values.put("details", s.getDetails());

    values.put("time", s.getTime());

    Log.d("Data:", s.getDestination() + s.getDetails());
    database.insert("wifi_table", null, values);
  }
Exemplo n.º 3
0
  public void insertWifi(Wifi_class s) {
    SQLiteDatabase database = this.getWritableDatabase();
    ContentValues values = new ContentValues();
    values.put("destination", s.getDestination());
    values.put("details", s.getDetails());
    values.put("time", s.getTime());

    Log.d("Data:", s.getDestination() + s.getDetails());
    database.insert("wifi_table", null, values);
    database.close();
  }