onItemSelected在更新版本8.0.0中不起作用

时间:2018-01-31 07:09:50

标签: java android

我在简单的微调器中显示了一个列表。未选择项目,并在Oreo设备中调用Onitemselected方法。我不明白为什么Oreo设备中存在这个问题,而所有其他版本的一切都运行良好。有人可以帮我吗?

    List<String> list = new ArrayList<String>();
    list.clear();
    try {
        ArrayList<LeaveApplicationModel.LeaveType> leaveTypeArrayList = LeaveApplicationModel.LeaveType.getLeaveTypeList();

        for (int i = 0; i < leaveTypeArrayList.size(); i++) {
            LeaveApplicationModel.LeaveType leaveType = leaveTypeArrayList.get(i);
            String leaveCode = leaveType.getLeaveTitle();

            list.add(leaveCode);

            LogUtility.printDebugMessage(TAG.concat("setLeaveTypeSpinnerList-list 1-") + list); //NON-NLS
        }

        if (!list.isEmpty()) {
            SpinnerAdapter adapter = new SpinnerAdapter(getContext(), list);
            spinnerDayType.setAdapter(adapter);
            spinnerDayType.setTag(leaveTypeArrayList);
        }

    } catch (Exception e) {
        // Crashlytics.logException(e);
        LogUtility.printErrorMessage(TAG.concat("setLeaveTypeSpinnerList--") + e); //NON-NLS
    }

0 个答案:

没有答案