android - Show DatePicker with other calendar system -
i have datepicker in custom dialog shows date , user can select date , user selected date. want go further showing other calendar
for e.g. persian calendar date instead of gregorian calender date. in app when user selects date datepicker can return persian date in log. don't know how change datepicker show perisan date.please help.
@override public boolean oncreateoptionsmenu(menu menu) { menu.add("add detail").seticon(r.drawable.ic_compose).setshowasaction(menuitem.show_as_action_if_room | menuitem.show_as_action_with_text); return true; } @override public boolean onoptionsitemselected(menuitem item) { final dialog dialog = new dialog(this); dialog.setcontentview(r.layout.custom); final edittext amount = (edittext) dialog.findviewbyid(r.id.amtedittext); final datepicker datepicker = (datepicker) dialog.findviewbyid(r.id.datepicker1); button cancelbutton = (button) dialog.findviewbyid(r.id.canelbutton); button okbutton = (button) dialog.findviewbyid(r.id.okbutton); okbutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { log.d("---------------", datepicker.getdayofmonth() +" " + datepicker.getmonth() + " " + datepicker.getyear() + " " + amount.gettext()); toast.maketext(mainactivity.this, "got click: " + datepicker.getdayofmonth() + " " + datepicker.getmonth() + " " + datepicker.getyear(), toast.length_short).show(); civildate civil = new civildate(datepicker.getyear(), datepicker.getmonth(), datepicker.getdayofmonth()); persiandate perdate = dateconverter.civiltopersian(civil); log.d("-------", perdate.getdayofmonth()+ " " + (perdate.getmonth() + 1) + " " + perdate.getyear() + " " + perdate.getmonthname()); datepicker.init(perdate.getyear(), (perdate.getmonth() + 1), perdate.getdayofmonth(), null); } });
instead of using datepicker
switch using android wheel library. it's written google developer , can styled android datepicker
provides consistent , feel on older phones.
it's not restricted can put in fields either means can use want.
Comments
Post a Comment