if (fieldName == Calendar.HOUR) { int max = calendar.getMaximum(Calendar.HOUR); int min = calendar.getMinimum(Calendar.HOUR); if ((value == max && amount == 1) || (value == min && amount == -1)) { int temp = currentField; currentField = getFieldIndex(Calendar.AM_PM); setTextField(Calendar.AM_PM, (calendar.get(Calendar.AM_PM) + 1) % 2, true, true); currentField = temp; } }
void incrementField(int amount) {	int fieldName = fieldNames[currentField];	int value = calendar.get(fieldName);	setTextField(fieldName, value + amount, true, true);}