Пример #1
0
  private void testDBFavoriteItem() {
    FavoriteItem item = new FavoriteItem();
    item.id = 1;
    item.isPublic = true;
    item.title = "my title";
    item.url = "http://www.google.com";
    item.createdTime = new Date();
    item.description = "我的标签";
    item.categoryNames = new ArrayList<String>();
    item.categoryNames.add("niceinc");
    item.categoryNames.add("mytype");

    try {
      this.updateFavoriteItem(item);
      FavoriteItem item2 = this.getFavoriteItem(1);
      item2.title = "i changed it";
      item2.isPublic = false;
      this.updateFavoriteItem(item2);
      FavoriteItem item3 = this.getFavoriteItem(1);
      int count = this.deleteFavoriteItem(1);
      // int count2 =this.deleteFavoriteItem(1);
      FavoriteItem item4 = this.getFavoriteItem(1);
      item4 = null;
    } catch (Exception e) {
      // Log.e(LOG_TAG, e.getMessage());
    }
  }
Пример #2
0
 private FavoriteItem buildFavorite(Cursor c) {
   FavoriteItem ret = new FavoriteItem();
   ret.id = c.getLong(0);
   ret.url = c.getString(1);
   ret.title = c.getString(2);
   ret.description = c.getString(3);
   ret.categoryNames = StringUtils.spliteByToken(c.getString(4), ",");
   ret.createdTime = new Date(c.getString(5));
   ret.isPublic = c.getInt(6) == 1 ? true : false;
   return ret;
 }