如何防止日历事件冲突?

时间:2018-02-01 09:46:44

标签: java android android-calendar java.util.calendar

我使用alamkanak / Android-Week-View库并且工作正常,但我想阻止这种情况发生:

Event collision

我试试这个:

        Calendar oldEndTime = null;

        Calendar oldStartTime = null;

        for (int i = 0; i < mNewEvents.size(); i++) {

            oldEndTime = mNewEvents.get(i).getEndTime();

            oldStartTime = mNewEvents.get(i).getStartTime();

        }
        if ( mNewEvents.size() == 0
            || event.getEndTime().before(oldStartTime)
            || event.getStartTime().after(oldEndTime)  ){

                mNewEvents.add(event);
        } else {
            Toast.makeText(this, "Noop", Toast.LENGTH_SHORT).show();
        }

1 个答案:

答案 0 :(得分:0)

请检查react-select@2.0.0-alpha.2循环的右括号是否设置正确。您在循环中设置foroldStartTime,但您的测试仅在循环之后完成一次。也许是这样的?

oldEndTime