use of com.ushahidi.android.app.entities.CategoryEntity in project Ushahidi_Android by ushahidi.
the class AddReportActivity method showCategories.
// fetch categories
public String[] showCategories() {
ListReportModel mListReportModel = new ListReportModel();
List<CategoryEntity> 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 (CategoryEntity category : mListReportModel.getAllCategories()) {
categories[i] = category.getCategoryTitle();
mCategoriesTitle.put(String.valueOf(category.getCategoryId()), category.getCategoryTitle());
mCategoriesId.add(category.getCategoryId());
i++;
}
return categories;
}
return null;
}
Aggregations