android - Hide Date and Year from DatePickerDialog -


i have datepickerdialog, want hide year , date fields dialog, possible hide specific field? if possible how can hide? in advance!!!

my code below

case r.id.ll_date:                     showdialog(999);                     break;  , dialog  @override     protected dialog oncreatedialog(int id) {         if (id == 999) {             datepickerdialog datepickerdialog = new datepickerdialog(mactivity, mydatelistener, curryear, currmonth, currday);             return new datepickerdialog(this, mydatelistener, curryear, currmonth, currday);         }         return null;     }          private datepickerdialog.ondatesetlistener mydatelistener = new datepickerdialog.ondatesetlistener() {         @override         public void ondateset(datepicker arg0, int year, int month, int day) {             calendar selectedcal = calendar.getinstance();             selectedcal.set(year, month, day);             dateformat df = new simpledateformat("mm/dd/yyyy", new locale("en_us"));             string date = df.format(new date());             string selecteddate = df.format(selectedcal.gettime());             try {                 date current = df.parse(date);                 date selected = df.parse(selecteddate);                 log.print("date =================== " + day);                 if (selected.before(current)) {                     showsnackbar(txtdate, getstring(r.string.alert_can_not_able_previous_date));                 } else {                     int month1 = month + 1;                     string date = (month1 < 10 ? ("0" + month1) : (month1)) + "/" + (day < 10 ? ("0" + day) : (day)) + "/" + year;                     txtdate.settext(date);                 }             } catch (parseexception e) {                 e.printstacktrace();             }         }     }; 

this works you: year hiding

datepickerdialogobject.findviewbyid(resources.getsystem().getidentifier("year", "id", "android")).setvisibility(view.gone); 

and hiding date datepicker

datepickerdialogobject.findviewbyid(resources.getsystem().getidentifier("day", "id", "android")).setvisibility(view.gone); 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -