Buggy code:
public class RecurringPickerDialog extends Dialog implements WeekView . OnDaySelectionChangedListener { private RecurringPickerDialog . ModeAdapter mModeAdapter ; private RecurringPickerDialog . EndAdapter mEndAdapter ; private EditText mPeriodEditText ; private TextView mPeriodUnitTextView ; private Spinner mModeSpinner ; private Spinner mEndSpinner ; private RadioButton mSameDayRadioButton ; private RadioButton mSameWeekdayRadioButton ; private EditText mEndNumEditText ; private TextView mEndNumUnitTextView ; private Button mEndDateButton ; private WeekView mWeekView ; private RecurringPickerDialog . HeaderDrawable mHeaderBackground ; private Recurring mRecurring ; private int mDatePickerDialogStyleId ; private static int [ ] MONTH_SAME_WEEKDAY = new int [ ] { string . rd_month_last , string . rd_month_first , string . rd_month_second , string . rd_month_third , string . rd_month_fourth } ; private DateFormat mDateFormat = SimpleDateFormat . getDateInstance ( ) ; public RecurringPickerDialog ( Context context ) { } public RecurringPickerDialog ( Context context , int style ) { } @ TargetApi ( VERSION_CODES . JELLY_BEAN ) @ Override protected void onCreate ( ) { View v = LayoutInflater . from ( getContext ( ) ) . inflate ( dialog_recurring , null ) ; setContentView ( v ) ; FrameLayout fl_mode = ( ( FrameLayout ) ( v . findViewById ( rd_fl_mode ) ) ) ; LinearLayout ll_repeat = ( ( LinearLayout ) ( v . findViewById ( rd_ll_repeat ) ) ) ; mModeSpinner = ( ( Spinner ) ( fl_mode . findViewById ( rd_spn_mode ) ) ) ; mEndSpinner = ( ( Spinner ) ( v . findViewById ( rd_spn_end ) ) ) ; mPeriodEditText = ( ( EditText ) ( v . findViewById ( rd_et_period ) ) ) ; mPeriodUnitTextView = ( ( TextView ) ( v . findViewById ( rd_tv_period_unit ) ) ) ; mSameDayRadioButton = ( ( RadioButton ) ( v . findViewById ( rd_month_rb_same ) ) ) ; mSameWeekdayRadioButton = ( ( RadioButton ) ( v . findViewById ( rd_month_rb_week ) ) ) ; mEndNumEditText = ( ( EditText ) ( v . findViewById ( rd_et_end_num ) ) ) ; mEndNumUnitTextView = ( ( TextView ) ( v . findViewById ( rd_tv_end_num_unit ) ) ) ; mEndDateButton = ( ( Button ) ( v . findViewById ( rd_bt_end_date ) ) ) ; <START_BUG> mWeekView = ( ( WeekView ) ( v . findViewById ( rd_week_wv ) ) ) ; <END_BUG> mHeaderBackground = new RecurringPickerDialog . HeaderDrawable ( getContext ( ) ) ; fl_mode . setPadding ( mContentPadding , 0 , mContentPadding , 0 ) ; if ( ( VERSION . SDK_INT ) >= ( VERSION_CODES . JELLY_BEAN ) ) fl_mode . setBackground ( mHeaderBackground ) ; else fl_mode . setBackgroundDrawable ( mHeaderBackground ) ; ll_repeat . setPadding ( mContentPadding , mActionOuterPadding , mContentPadding , mActionPadding ) ; mModeAdapter = new RecurringPickerDialog . ModeAdapter ( ) ; mModeSpinner . setAdapter ( mModeAdapter ) ; mModeSpinner . setOnItemSelectedListener ( new Spinner . OnItemSelectedListener ( ) { @ Override public void onItemSelected ( Spinner parent , View view , int position , long id ) { onModeSelected ( position ) ; } } ) ; mEndAdapter = new RecurringPickerDialog . EndAdapter ( ) ; mEndSpinner . setAdapter ( mEndAdapter ) ; mEndSpinner . setOnItemSelectedListener ( new Spinner . OnItemSelectedListener ( ) { @ Override public void onItemSelected ( Spinner parent , View view , int position , long id ) { onEndSelected ( position ) ; } } ) ; mPeriodEditText . addTextChangedListener ( new TextWatcher ( ) { @ Override public void beforeTextChanged ( CharSequence s , int start , int count , int after ) { } @ Override public void onTextChanged ( CharSequence s , int start , int before , int count ) { } @ Override public void afterTextChanged ( Editable s ) { onPeriodChanged ( ) ; } } ) ; mPeriodEditText . setOnKeyListener ( new View . OnKeyListener ( ) { @ Override public boolean onKey ( View v , int keyCode , KeyEvent event ) { if ( ( keyCode == ( KeyEvent . KEYCODE_ENTER ) ) && ( ( event . getAction ( ) ) == ( KeyEvent . ACTION_UP ) ) ) { String text = mPeriodEditText . getText ( ) . toString ( ) ; if ( TextUtils . isEmpty ( text ) ) mPeriodEditText . setText ( String . valueOf ( mRecurring . getPeriod ( ) ) ) ; } return false ; } } ) ; CompoundButton . OnCheckedChangeListener mCheckChangeListener = new OnCheckedChangeListener ( ) { @ Override public void onCheckedChanged ( android . widget . CompoundButton buttonView , boolean isChecked ) { if ( isChecked ) { if ( buttonView == ( mSameDayRadioButton ) ) mSameWeekdayRadioButton . setChecked ( false ) ; else mSameDayRadioButton . setChecked ( false ) ; onMonthSettingChanged ( ) ; } } } ; mSameDayRadioButton . setOnCheckedChangeListener ( mCheckChangeListener ) ; mSameWeekdayRadioButton . setOnCheckedChangeListener ( mCheckChangeListener ) ; mEndNumEditText . addTextChangedListener ( new TextWatcher ( ) { @ Override public void beforeTextChanged ( CharSequence s , int start , int count , int after ) { } @ Override public void onTextChanged ( CharSequence s , int start , int before , int count ) { } @ Override public void afterTextChanged ( Editable s ) { onEventNumberChanged ( ) ; } } ) ; mEndNumEditText . setOnKeyListener ( new View . OnKeyListener ( ) { @ Override public boolean onKey ( View v , int keyCode , KeyEvent event ) { if ( ( keyCode == ( KeyEvent . KEYCODE_ENTER ) ) && ( ( event . getAction ( ) ) == ( KeyEvent . ACTION_UP ) ) ) { String text = mEndNumEditText . getText ( ) . toString ( ) ; if ( TextUtils . isEmpty ( text ) ) mEndNumEditText . setText ( String . valueOf ( mRecurring . getEventNumber ( ) ) ) ; } return false ; } } ) ;

Fix:
mWeekView = ( ( WeekView ) ( v . findViewById ( rd_wv_week ) ) ) ;