android - How to create datePicker and timePicker dialogs in fragment class? -



android - How to create datePicker and timePicker dialogs in fragment class? -

i want know there way create datepicker in fragment? creating 1 regular activity may , gives me syntax error. right way this?

you need utilize dialogfragment. found info here:

show dialog fragment?

and big help here:

https://github.com/commonsguy/cw-advandroid/blob/master/honeycomb/feedfragments/src/com/commonsware/android/feedfrags/addfeeddialogfragment.java

this should help on way, doing thing now. though within illustration code don't utilize builder , instead return:

return new datepickerdialog(getactivity(), mdatesetlistener, myear, mmonth, mday);

this seems work... though cannot figure out yet how update text on fragment calls dialogfragment. thought work , doesn't:

public void updatedisplay() { //update our button text calling fragment, isn't quite working //doesn't crash doesn't update...must missing something. view v=getactivity() .getlayoutinflater() .inflate(r.layout.session_edits, null); button sessiondate = (button)v.findviewbyid(r.id.sessionpickdate); sessiondate.settext(new stringbuilder() .append(mmonth+1).append("-").append(mday).append("-").append(myear).append(" ")); }

android

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -