DatePickerDialog - context parameter in constructor is not accepting
<p>I am trying to make a generic method using Android DatePickerDialog , so instead of using DatePickerDialog  everytime it will be called through a generic function and return the date. It may be part of customized component component as well (i.e. LinearLayout or NavigationView ).</p>

<p>However I am stuck due to context parameter in the constructor of DatePickerDialog . It insist actual activity class name , and I am something looking like parameter ie getContext(), getApplicationContext() etc..</p>

<p>Working but can't be used in generic method - <code>DatePickerDialog datePickerDialog = new DatePickerDialog(RecordActivity3.this, new DatePickerDialog.OnDateSetListener() {</code></p>

<p>Not working - <code>DatePickerDialog datePickerDialog = new DatePickerDialog(getContext(), new DatePickerDialog.OnDateSetListener() {</code></p>

<p>Not working - <code>DatePickerDialog datePickerDialog = new DatePickerDialog(getApplicationContext(), new DatePickerDialog.OnDateSetListener() {</code></p>

<p>Not working - <code>DatePickerDialog datePickerDialog = new DatePickerDialog(activityClassParamter, new DatePickerDialog.OnDateSetListener() {</code></p>

<p>Please suggest in case you have worked on similar problem.. </p>