android - DatePickerFragment an cleaning project -
i have datepickerfragment in android project:
public class uses extends fragmentactivity { @override public void oncreate(bundle savedinstancestate) { //code } public class parkinglisthttp extends asynctask<string, void, string> { //code } @override protected void onpostexecute(string result) { //code } public void returnuses(string date) { //code } public void selectdate(view v) { dialogfragment newfragment = new datepickerfragment(); newfragment.show(getsupportfragmentmanager(), "datepicker"); } public class datepickerfragment extends dialogfragment implements datepickerdialog.ondatesetlistener { @override public dialog oncreatedialog(bundle savedinstancestate) { // use current date default date in picker final calendar c = calendar.getinstance(); int year = c.get(calendar.year); int month = c.get(calendar.month); int day = c.get(calendar.day_of_month); // create new instance of datepickerdialog , return return new datepickerdialog(getactivity(), this, year, month, day); } public void ondateset(datepicker view, int year, int month, int day) { // date chosen user string datetext = context.getstring(r.string.date_name); string[] strdays = new string[]{"dom", "lun", "mar", "mie", "jue", "vie", "sáb"}; final calendar c = calendar.getinstance(); c.set(calendar.year, year); c.set(calendar.month, month-1); c.set(calendar.day_of_month, day); int week = c.get(calendar.day_of_week); date.settext(datetext.replacefirst("\\*",strdays[week - 1] + " " + day + "/" + (month+1)+"/"+year)); returnuses(year+"-"+(month+1)+"-"+day); } }
}
when change code in project line
public class datepickerfragment extends dialogfragment implements datepickerdialog.ondatesetlistener {
returns error:
fragment inner class should static (com.usualbike.mandemo.uses.datepickerfragment)
but it's solved cleaning project.
how can avoid error+cleaning?
Comments
Post a Comment