@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.text_and_button); text = (TextView) findViewById(R.id.text); button = (Button) findViewById(R.id.button); text.setText("--"); button.setText("Set Time"); button.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { FragmentManager fm = getSupportFragmentManager(); DateTime now = DateTime.now(); RadialTimePickerDialog timePickerDialog = RadialTimePickerDialog.newInstance( SampleRadialTimeCustom.this, now.getHourOfDay(), now.getMinuteOfHour(), DateFormat.is24HourFormat(SampleRadialTimeCustom.this)); timePickerDialog.setThemeCustom(R.style.MyCustomBetterPickersRadialTimePickerDialog); timePickerDialog.show(fm, FRAG_TAG_TIME_PICKER); } }); }
@Override public void onResume() { // Example of reattaching to the fragment super.onResume(); RadialTimePickerDialog rtpd = (RadialTimePickerDialog) getSupportFragmentManager().findFragmentByTag(FRAG_TAG_TIME_PICKER); if (rtpd != null) { rtpd.setOnTimeSetListener(this); } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.text_and_button); text = (TextView) findViewById(R.id.text); button = (Button) findViewById(R.id.button); text.setText("--"); button.setText("Set Date"); button.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { DatePickerBuilder dpb = new DatePickerBuilder() .setFragmentManager(getFragmentManager()) .setStyleResId(R.style.MyCustomBetterPickerTheme); dpb.show(); } }); }