Ejemplo n.º 1
0
  public List<ViewItem> getPageInChapter(String chapterUrl) {
    List<ViewItem> list = new ArrayList<ViewItem>();
    try {
      String selectQuery =
          "SELECT  * FROM " + TABLE_PAGE + " r  " + "WHERE r.chapterUrl = '" + chapterUrl + "'";

      SQLiteDatabase db = this.getReadableDatabase();
      Cursor c = db.rawQuery(selectQuery, null);

      if (c.moveToFirst()) {
        do {
          ViewItem item = new ViewItem(c.getString(c.getColumnIndex("imageUrl")));
          item.setChapterUrl(c.getString(c.getColumnIndex("chapterUrl")));
          item.setFileUrl(c.getString(c.getColumnIndex("fileUrl")));
          item.setOrder(c.getInt(c.getColumnIndex("stt")));

          list.add(item);
        } while (c.moveToNext());
      }
      c.close();
    } catch (Exception e) {

    }
    return list;
  }
Ejemplo n.º 2
0
  public ViewItem getPage(String imageUrl) {
    try {
      String selectQuery =
          "SELECT  * FROM " + TABLE_PAGE + " r  " + "WHERE r.imageUrl = '" + imageUrl + "'";

      SQLiteDatabase db = this.getReadableDatabase();
      Cursor c = db.rawQuery(selectQuery, null);

      if (c.moveToFirst()) {

        ViewItem item = new ViewItem(c.getString(c.getColumnIndex("imageUrl")));
        item.setChapterUrl(c.getString(c.getColumnIndex("chapterUrl")));
        item.setFileUrl(c.getString(c.getColumnIndex("fileUrl")));
        item.setOrder(c.getInt(c.getColumnIndex("stt")));

        return item;
      }
      c.close();
    } catch (Exception e) {

    }
    return null;
  }