// Na odabir stavke menija.
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case R.id.addItemToList:
        Intent intent = new Intent(this, AddItem.class);
        intent.putExtra("listName", listName);
        startActivity(intent);
        finish();
        break;
      case R.id.refreshItems:
        Intent intent2 = new Intent(this, EditListItems.class);
        intent2.putExtra("listName", listName);
        startActivity(intent2);
        finish();
        break;

      case R.id.cleanItems:
        ArrayList<Item> items = list.getItems();
        int n = items.size();
        for (int i = 0; i < n; i++) {
          if (list.getItems().get(i).isDone()) {
            list.removeItem(i);
            i--;
            n--;
          }
        }

        String string = list.toXMLplist();
        FileOutputStream fos;
        try {
          fos = openFileOutput(listName, Context.MODE_PRIVATE);
          fos.write(string.getBytes());
          fos.close();
          Util.listChanged(listName, getApplicationContext());
        } catch (Exception e) {
          e.printStackTrace();
        }

        Intent intent3 = new Intent(getApplicationContext(), EditListItems.class);
        intent3.putExtra("listName", listName);
        startActivity(intent3);
        finish();
        break;
    }
    return true;
  }
 // Popunjavanje ListView-a Itemima.
 private String[] populateList() {
   ArrayList<Item> items = list.getItems();
   String[] item_row = new String[items.size()];
   for (int i = 0; i < items.size(); ++i) {
     Item item = items.get(i);
     String status = item.isDone() ? "  " + Html.fromHtml("&#10004;") : "";
     item_row[i] = item.getName() + ", " + item.getCount() + status;
   }
   return item_row;
 }