@Override public View newView(Context context, Cursor cursor, ViewGroup parent) { final View view = mFactory.inflate(R.layout.alarm_time, parent, false); // standard view holder optimization final ItemHolder holder = new ItemHolder(); holder.alarmItem = (LinearLayout) view.findViewById(R.id.alarm_item); holder.clock = (DigitalClock) view.findViewById(R.id.digital_clock); holder.clock.setLive(false); holder.onoff = (Switch) view.findViewById(R.id.onoff); holder.onoff.setTypeface(mRobotoNormal); holder.daysOfWeek = (TextView) view.findViewById(R.id.daysOfWeek); holder.label = (TextView) view.findViewById(R.id.label); holder.expandArea = view.findViewById(R.id.expand_area); holder.infoArea = view.findViewById(R.id.info_area); holder.repeat = (CheckBox) view.findViewById(R.id.repeat_onoff); holder.clickableLabel = (TextView) view.findViewById(R.id.edit_label); holder.hairLine = view.findViewById(R.id.hairline); holder.repeatDays = (LinearLayout) view.findViewById(R.id.repeat_days); // Build button for each day. for (int i = 0; i < 7; i++) { final ViewGroup viewgroup = (ViewGroup) mFactory.inflate(R.layout.day_button, holder.repeatDays, false); final ToggleButton button = (ToggleButton) viewgroup.getChildAt(0); final int dayToShowIndex = DAY_ORDER[i]; button.setText(mShortWeekDayStrings[dayToShowIndex]); button.setTextOn(mShortWeekDayStrings[dayToShowIndex]); button.setTextOff(mShortWeekDayStrings[dayToShowIndex]); button.setContentDescription(mLongWeekDayStrings[dayToShowIndex]); holder.repeatDays.addView(viewgroup); holder.dayButtons[i] = button; holder.dayButtonParents[i] = viewgroup; } holder.vibrate = (CheckBox) view.findViewById(R.id.vibrate_onoff); holder.collapse = (ViewGroup) view.findViewById(R.id.collapse); holder.ringtone = (TextView) view.findViewById(R.id.choose_ringtone); view.setTag(holder); return view; }