/** * Get check selected categories * * @param aSelectedCategories */ private boolean[] setCheckedCategories() { // FIXME: Look into making this more efficient if (mVectorCategories != null && mVectorCategories.size() > 0) { ListReportModel mListReportModel = new ListReportModel(); List<Category> listCategories = mListReportModel.getAllCategories(); if (listCategories != null && listCategories.size() > 0) { int categoryCount = listCategories.size(); int categoryAmount = 0; if (categoryCount > 0) { categoryAmount = categoryCount; } else { categoryAmount = 1; } boolean categories[] = new boolean[categoryAmount]; mCategoryLength = categories.length; int i = 0; for (Category category : mListReportModel.getAllCategories()) { if (mVectorCategories.contains(String.valueOf(category.getCategoryId()))) { categories[i] = true; } else { categories[i] = false; } i++; } return categories; } } return null; }
// fetch categories public String[] showCategories() { ListReportModel mListReportModel = new ListReportModel(); List<Category> listCategories = mListReportModel.getAllCategories(); if (listCategories != null && listCategories.size() > 0) { int categoryCount = listCategories.size(); int categoryAmount = 0; if (categoryCount > 0) { categoryAmount = categoryCount; } else { mCategoriesId.clear(); mCategoriesTitle.clear(); categoryAmount = 1; } String categories[] = new String[categoryAmount]; mCategoryLength = categories.length; int i = 0; for (Category category : mListReportModel.getAllCategories()) { categories[i] = category.getCategoryTitle(); mCategoriesTitle.put(String.valueOf(category.getCategoryId()), category.getCategoryTitle()); mCategoriesId.add(String.valueOf(category.getCategoryId())); i++; } return categories; } return null; }