Source:
protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.time_dialog); setTitle(R.string.menu_time); dateTimeReadout = (TextView) findViewById(R.id.dateDisplay); Button changeDateButton = (Button) findViewById(R.id.pickDate); changeDateButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (SystemClock.elapsedRealtime() - LastClickTime < 1000) return; LastClickTime = SystemClock.elapsedRealtime(); createDatePicker().show(); } }); Button changeTimeButton = (Button) findViewById(R.id.pickTime); changeTimeButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (SystemClock.elapsedRealtime() - LastClickTime < 1000) return; LastClickTime = SystemClock.elapsedRealtime(); createTimePicker().show(); } }); Button goButton = (Button) findViewById(R.id.timeTravelGo); goButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { parentActivity.setTimeTravelMode(calendar.getTime()); dismiss(); } }); Button cancelButton = (Button) findViewById(R.id.timeTravelCancel); cancelButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dismiss(); } }); popularDatesMenu = (Spinner) findViewById(R.id.popular_dates_spinner); ArrayAdapter<?> adapter = ArrayAdapter.createFromResource( this.getContext(), R.array.popular_date_examples, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); popularDatesMenu.setAdapter(adapter); popularDatesMenu.setSelection(1); popularDatesMenu.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { setPopularDate(popularDatesMenu.getSelectedItemPosition()); } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); calendar.setTime(new Date()); updateDisplay(); }

Target:
protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.time_dialog); setTitle(R.string.menu_time); dateTimeReadout = (TextView) findViewById(R.id.dateDisplay); Button changeDateButton = (Button) findViewById(R.id.pickDate); changeDateButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (SystemClock.elapsedRealtime() - lastClickTime < MIN_CLICK_TIME) return; lastClickTime = SystemClock.elapsedRealtime(); createDatePicker().show(); } }); Button changeTimeButton = (Button) findViewById(R.id.pickTime); changeTimeButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (SystemClock.elapsedRealtime() - lastClickTime < MIN_CLICK_TIME) return; lastClickTime = SystemClock.elapsedRealtime(); createTimePicker().show(); } }); Button goButton = (Button) findViewById(R.id.timeTravelGo); goButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { parentActivity.setTimeTravelMode(calendar.getTime()); dismiss(); } }); Button cancelButton = (Button) findViewById(R.id.timeTravelCancel); cancelButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dismiss(); } }); popularDatesMenu = (Spinner) findViewById(R.id.popular_dates_spinner); ArrayAdapter<?> adapter = ArrayAdapter.createFromResource( this.getContext(), R.array.popular_date_examples, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(R.layout.spinner_dropdown_item); popularDatesMenu.setAdapter(adapter); popularDatesMenu.setSelection(1); popularDatesMenu.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { setPopularDate(popularDatesMenu.getSelectedItemPosition()); } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); calendar.setTime(new Date()); updateDisplay(); }