Rafael Osuna Posted August 9, 2012 Share Posted August 9, 2012 Hi All! I've a problem with a DatePickerDialog following steps from Android Tutorial. Linking a TextView to launch a DatePickerDialog when gets focused as you can see below: EditText fNac = (EditText)findViewById(R.id.regFecha); fNac.setonfocusChangeListener(new View.onfocusChangeListener(){ @Override public void onfocusChange(View v, boolean hasFocus) { // TODO Auto-generated method stub // Desde aquí lanzamos el datepicker if (hasFocus){ DialogFragment newFragment = new DatePickerFragment(); newFragment.show(getSupportFragmentManager() , "datePicker"); } } Works fine, the DatePickerDialog is launched. I instance a new DatePickerFragment class that is created in this way: import java.util.Calendar; import android.app.DatePickerDialog; import android.app.Dialog; import android.os.Bundle; import android.support.v4.app.DialogFragment; import android.util.Log; import android.widget.DatePicker; public class DatePickerFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener { private DatePickerDialog mDatePickerDialog; @Override public Dialog onCreateDialog(Bundle savedInstanceState){ // Usamos la fecha actual como primera fecha a mostrar final Calendar c = Calendar.getInstance(); int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH); int day = c.get(Calendar.DAY_OF_MONTH); // Devolvemos la instancia de un Dialog con la fecha actual mDatePickerDialog = new DatePickerDialog(getActivity(),this,year,month,day); return mDatePickerDialog; } @Override public void onDateSet(DatePicker view, int year, int month, int day) { // TODO Auto-generated method stub Log.v("LOG_CAT","OK"); } public void onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth) { // TODO Auto-generated method stub Log.v("LOG_CAT", "Ok2"); } } And here is the problem. I want to change Dialog's title using onDateChanged method, but it's never called. I tried to create a onDateChangedListener but DatePickerDialog doesn't have one. How can i do this? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.