public List<Map<String, Object>> getAllCategory() { // categoryList = rapi.listFolder(); Map<String, Object> map = new HashMap<String, Object>(); map.put("category", "选择分类"); map.put("id", ""); map.put("time", ""); categoryList.add(map); map = new HashMap<String, Object>(); categoryNameList.add("选择分类"); db = new DBHelper(this); Cursor cur = db.loadAllCategory(userid); if (cur.moveToFirst()) { do { map.put("category", cur.getString(1)); map.put("id", cur.getInt(0)); map.put("time", cur.getString(2)); categoryNameList.add(cur.getString(1)); categoryList.add(map); map = new HashMap<String, Object>(); } while (cur.moveToNext()); } cur.close(); db.close(); return categoryList; }
public String getDefaultCategory(int id) { db = new DBHelper(EditArticle.this); Cursor cur = db.getCategoryById(id + ""); cur.moveToFirst(); String categoryName = cur.getString(0); cur.close(); db.close(); return categoryName; }