/**
   * Get the names of all the blogs configured within the application. If a blog does not have a
   * specific name, the blog URL is returned.
   *
   * @return array of blog names
   */
  private static String[] getBlogNames() {
    List<Map<String, Object>> accounts = WordPress.wpDB.getAccounts();

    int blogCount = accounts.size();
    blogIDs = new int[blogCount];
    String[] blogNames = new String[blogCount];

    for (int i = 0; i < blogCount; i++) {
      Map<String, Object> account = accounts.get(i);
      String name;
      if (account.get("blogName") != null) {
        name = EscapeUtils.unescapeHtml(account.get("blogName").toString());
      } else {
        name = account.get("url").toString();
      }
      blogNames[i] = name;
      blogIDs[i] = Integer.valueOf(account.get("id").toString());
    }

    return blogNames;
  }
  private void loadCategories() {
    loadTextArray.clear();
    formattedTextArray.clear();
    List<?> categoriesVector = WordPress.wpDB.loadCategories(id);
    if (categoriesVector.size() > 0) {

      for (int i = 0; i < categoriesVector.size(); i++) {
        loadTextArray.add(categoriesVector.get(i).toString());
        formattedTextArray.add(EscapeUtils.unescapeHtml(categoriesVector.get(i).toString()));
      }

      ArrayAdapter<CharSequence> categories =
          new ArrayAdapter<CharSequence>(this, R.layout.categories_row, formattedTextArray);

      this.setListAdapter(categories);

      if (checkedCategories != null) {
        ListView lv = getListView();
        for (int i = 0; i < checkedCategories.length; i++) {

          lv.setItemChecked((int) checkedCategories[i], true);
        }

      } else if (categoriesCSV != null) {
        String catsArray[] = categoriesCSV.split(",");
        ListView lv = getListView();
        for (int i = 0; i < loadTextArray.size(); i++) {

          for (int x = 0; x < catsArray.length; x++) {
            if (catsArray[x].equals(loadTextArray.get(i).toString())) {
              lv.setItemChecked(i, true);
            }
          }
        }
      }
    } else {
      refreshCategories();
    }
  }