This is my code which I originally used, in this code I try to execute an asynchronous method in a DatePickerDialog
@SuppressLint("ValidFragment")
public static class DatePickerFragment extends DialogFragment //Se modifica a metodo estatico
implements DatePickerDialog.OnDateSetListener {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
return new DatePickerDialog(getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT , this, year, month, day);
}
public void onDateSet(DatePicker view, int y, int m, int d) {
year = y;
month = m;
day = d;
globalVariable.calendar.set(year, m, day);
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
fechaSelected = sdf.format(globalVariable.calendar.getTime());
new getEventsAyncTask().execute(); //método que no es estático
}
}
The problem is that you need the method to be static to run it inside the pickerdialog some idea of how to do it without having to change the asynchronous method to static?