Beispiel #1
0
  public boolean getMyListsFromDB() {
    OneTimeDBHelper oDBH = new OneTimeDBHelper(this);

    // add myPlantList from Shared Plants
    mPlantList.addAll(oDBH.getAllMyListInformation(this));

    Log.i("K", "the number of mylist (size) : " + mPlantList.size());

    oDBH.close();

    if (mPlantList.size() > 0) {
      return true;
    }
    return false;
  }
Beispiel #2
0
  private void showCategory() {
    mArr = new ArrayList<ListGroupItem>();

    // add lists except endangered list
    // my observations
    ListGroupItem gItem = new ListGroupItem();
    gItem.setCategoryID(0);
    gItem.setCategoryName("My Observation");
    mArr.add(gItem);

    // others' observations
    gItem = new ListGroupItem();
    gItem.setCategoryID(1);
    gItem.setCategoryName("Others' Observation");
    mArr.add(gItem);

    // add quick capture observations into the array
    OneTimeDBHelper oDBH = new OneTimeDBHelper(MapViewMain.this);
    mArr.addAll(oDBH.getListGroupItem(MapViewMain.this));

    int arrLength = mArr.size();

    mPlantCategory = new String[arrLength];
    mSelect = new boolean[arrLength];

    for (int i = 0; i < arrLength; i++) {
      mPlantCategory[i] = mArr.get(i).getCategoryName();
      mSelect[i] = false;
    }

    new AlertDialog.Builder(MapViewMain.this)
        .setTitle(getString(R.string.cateogory_text))
        .setSingleChoiceItems(
            mPlantCategory,
            -1,
            new DialogInterface.OnClickListener() {

              @Override
              public void onClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub
                mSelect[which] = true;
              }
            })
        .setPositiveButton(
            "Done",
            new DialogInterface.OnClickListener() {

              @Override
              public void onClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub
                for (int i = 0; i < mSelect.length; i++) {
                  if (mSelect[i]) {
                    if (i == 0) {
                      showBudburstSpeciesOnMap(false);
                    } else {
                      getOtherUsersListsFromServer(mArr.get(i).getCategoryID());
                    }
                  }
                }
              }
            })
        .setNegativeButton(getString(R.string.Button_back), null)
        .show();
  }