I want to know is there a way to create a datePicker in a fragment? I am creating one the regular activity may and it gives me syntax error. What is the correct way to do this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You will most likely need to use a DialogFragment. I found some information here:
Show dialog from fragment?
and also a big help here:
https://github.com/commonsguy/cw-advandroid/blob/master/Honeycomb/FeedFragments/src/com/commonsware/android/feedfrags/AddFeedDialogFragment.java
This should help you get on your way, I am doing this very thing now. Though inside the example code I don’t use a builder and instead just return:
This seems to work… though I cannot figure out yet how to update the text on the fragment that calls this DialogFragment. I thought this would work and it doesn’t: