Currently I am using date picker native one but i want to change it in such a way that i only needed month and year how to modify this my code is following
I modified few things like: Made style the android default Theme_Holo_Dialog and delete the day from the visibility.
Following few changes my code is:
pick_expire_date.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Get Current Date
final Calendar c = Calendar.getInstance();
cyear = c.get(Calendar.YEAR);
cmonth = c.get(Calendar.MONTH);
cday = c.get(Calendar.DAY_OF_MONTH);
DatePickerDialog datePickerDialog = new DatePickerDialog(
CheckoutPaymentActivity.this,
android.R.style.Theme_Holo_Dialog,
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year,
int monthOfYear, int dayOfMonth) {
pick_expire_date.setText((monthOfYear + 1)+"/"+year);
mMonth = monthOfYear + 1;
mYear = year;
}
},
cyear, cmonth, cday);
datePickerDialog.getDatePicker().findViewById(getResources().getIdentifier("day","id","android")).setVisibility(View.GONE);
datePickerDialog.show();
}
});