コード例 #1
0
 /** This method is used to prepare ID to get the entry's id which will used in entry detail. */
 @SuppressWarnings("unchecked")
 public void prepareIDS() {
   ID_ARRAY.clear();
   for (SmartListItem row : listData) {
     ID_ARRAY.add(((ArrayList<HashMap<String, String>>) row.getValues().get(0)).get(0).get(ID));
   }
 }
コード例 #2
0
  /**
   * This method is used to prepare initial list from response data.
   *
   * @param data : data from response.
   */
  public void prepareList(
      List<ArrayList<HashMap<String, String>>> data,
      boolean append,
      boolean fromCache,
      int pageno,
      int pagelimit) {
    if (data != null) {
      if (!append) {
        listData.clear();
      } else {
        if (!fromCache) {
          int startIndex = ((pageno - 1) * pagelimit);
          int endIndex = listAdapterWithHolder.getCount();
          if (startIndex > 0) {
            for (int i = endIndex; i >= startIndex; i--) {
              try {
                listAdapterWithHolder.remove(listAdapterWithHolder.getItem(i));
                listData.remove(i);
              } catch (Exception e) {
              }
            }
          }
        }
      }

      for (ArrayList<HashMap<String, String>> hashMap : data) {

        SmartListItem item = new SmartListItem();
        item.setItemLayout(R.layout.sobipro_car_entries_item);
        ArrayList<Object> obj = new ArrayList<Object>();
        obj.add(hashMap);
        item.setValues(obj);
        if (append) {
          listAdapterWithHolder.add(item);
        } else {
          listData.add(item);
        }
      }
    }
  }