Exemple #1
0
  public List<History> getHistory() {
    ArrayList<History> historys = new ArrayList<History>();

    try {

      Cursor c =
          db.query(
              HISTORY_TABLE,
              new String[] {"history_id", "displaytext", "url"},
              null,
              null,
              null,
              null,
              null);

      int numRows = c.getCount();
      c.moveToFirst();

      for (int i = 0; i < numRows; ++i) {
        History history = new History();
        history.historyId = c.getLong(0);
        history.displayText = c.getString(1);
        history.url = c.getString(2);
        historys.add(history);
        c.moveToNext();
      }

      c.close();

    } catch (SQLException e) {
    }
    return historys;
  }