固然是關閉這坑貨了:ide
//禁止OnItemSelectedListener默認自動調用一次 spinnerDutyPerson.setSelection(0, true); //放到TagContainer裏 spinnerDutyPerson.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (cjExecutorNames.size() > 0) { //若要刪除舊的聯繫人 /* preDutyPerson = cjExecutorNames.get(position);//記錄責任人 List<String> tags = tagContainer.getTags(); if (tags.size() > 0) { Iterator<String> iterator = tags.iterator(); String tag; while (iterator.hasNext()) { tag = iterator.next(); if (tag.equals(preDutyPerson)) { iterator.remove(); } } }*/ List<String> tags = tagContainer.getTags(); tags.add(cjExecutorNames.get(position)); tagContainer.setTags(tags); } } @Override public void onNothingSelected(AdapterView<?> parent) { } });