@Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (parent == mSpinnerGeology) { geologyIndex = position; new PreferencesUtil(getContext()).save("geologyIndex", geologyIndex); initConditions(getActivity()); initConditions(getActivity()); initConditiontValue(getActivity()); changeAllGeology(); } if (parent == mSpinnerCondition) { conditionIndex = position; initConditions(getActivity()); initConditiontValue(getActivity()); } if (parent == mSpinnerConditionValue) { conditionValueIndex = position; } String selectItem = null; try { selectItem = mSpinnerConditionValue.getSelectedItem().toString(); } catch (Exception e) { e.printStackTrace(); } slog.p(TAG, "selectItem " + selectItem); if (mETValue1 != null && mETValue2 != null) { if (selectItem != null && selectItem.equals("自定义")) { mETValue1.setVisibility(View.VISIBLE); mETValue2.setVisibility(View.VISIBLE); } else { mETValue1.setVisibility(View.GONE); mETValue2.setVisibility(View.GONE); } } }
public String getSpinnerValue(int index) { String value = null; slog.p(TAG, "getFirstSpinnerValue index is " + index); switch (index) { case 0: value = (String) mSpinnerFisrt.getSelectedItem(); break; case 1: value = (String) mSpinnerGeology.getSelectedItem(); break; case 2: value = (String) mSpinnerCondition.getSelectedItem(); break; case 3: value = (String) mSpinnerConditionValue.getSelectedItem(); break; } slog.p(TAG, "getFirstSpinnerValue value is " + value); return value; }