I am creating a newInstance
within a fragment. The documentation says that it is like this
public static Clase newInstance(int index,CheckBox check) {
Clase categories = new Clase ();
java.util.Calendar now = java.util.Calendar.getInstance();
TimePickerDialog tpd = new TimePickerDialog(
this,
now.get(java.util.Calendar.HOUR_OF_DAY),
now.get(java.util.Calendar.MINUTE),
check.isChecked()
);
The problem is that calling the context this.getContext()
or Clase.this
tells me that the context can not be referenced within a static method.
Can someone help me with this? Since to be able to instantiate within a fragment I must do it with a static method, and in that class TimePickerDialog
I need to pass the context.