Esempio n. 1
0
  public void openLastSearch(View view) {
    // Suchanfragen aus Speicher holen

    String[] projection = {
      KleFuEntry.COLUMN_NAME_GEBIET, // 0
      KleFuEntry.COLUMN_NAME_GIPFELNUMMER_VON, // 1
      KleFuEntry.COLUMN_NAME_GIPFELNUMMER_BIS, // 2
      KleFuEntry.COLUMN_NAME_GIPFEL, // 3
      KleFuEntry.COLUMN_NAME_WEGNAME, // 4
      KleFuEntry.COLUMN_NAME_SCHWIERIGKEIT_VON, // 5
      KleFuEntry.COLUMN_NAME_SCHWIERIGKEIT_BIS, // 6
      KleFuEntry.COLUMN_NAME_GEKLETTERT, // 7
      KleFuEntry.COLUMN_NAME_NOCH_NICHT_GEKLETTERT // 8
    };
    Cursor c =
        KleFuEntry.db.query(
            KleFuEntry.TABLE_NAME_SUCHANFRAGEN, // The table to query
            projection, // The columns to return
            null, // The columns for the WHERE clause
            null, // The values for the WHERE clause
            null, // don't group the rows
            null, // don't filter by row groups
            null // The sort order
            );

    c.moveToLast();
    suchanfrage =
        new Suchanfrage(
            c.getString(0),
            c.getInt(1),
            c.getInt(2),
            c.getString(3),
            c.getString(4),
            new Schwierigkeit(c.getInt(5)),
            new Schwierigkeit(c.getInt(6)),
            c.getInt(7) > 0,
            c.getInt(8) > 0);
    c.close();

    sucheHandler = new SucheHandler(this, this, sucheThread);
    sucheThread = new SucheThread(this, this);
    sucheThread.start();
  }
Esempio n. 2
0
 @OnClick({R.id.add_data, R.id.query_data})
 public void onClick(View view) {
   switch (view.getId()) {
     case R.id.add_data:
       ContentValues values = new ContentValues();
       values.put("name", "GOT");
       values.put("pages", 566);
       database.insert("Book", null, values);
       break;
     case R.id.query_data:
       Cursor cursor = database.query("Book", null, null, null, null, null, null);
       if (cursor != null) {
         while (cursor.moveToNext()) {
           String name = cursor.getString(cursor.getColumnIndex("name"));
           int pages = cursor.getInt(cursor.getColumnIndex("pages"));
           Log.d("TAG", "book names is " + name);
           Log.d("TAG", "book pages is " + pages);
         }
       }
       cursor.close();
       break;
   }
 }