Search in sources :

Example 11 with CategoryEntity

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;
}
Also used : ListReportModel(com.ushahidi.android.app.models.ListReportModel) CategoryEntity(com.ushahidi.android.app.entities.CategoryEntity)

Aggregations

CategoryEntity (com.ushahidi.android.app.entities.CategoryEntity)11 ListReportModel (com.ushahidi.android.app.models.ListReportModel)3 Category (com.ushahidi.java.sdk.api.Category)2 JsonSyntaxException (com.google.gson.JsonSyntaxException)1 Util (com.ushahidi.android.app.util.Util)1 UshahidiException (com.ushahidi.java.sdk.UshahidiException)1 ArrayList (java.util.ArrayList)1