Skip to content Skip to sidebar Skip to footer

Android - Date Picker - Obatin Value

I am using a DatePicker Dialog in my activity for the user to select a Date. What I want to do is to display the selected date in a textView. Can anyone please help me on how to ob

Solution 1:

in onDateSet method,

String cuurent_date = String.valueOf(c.get(Calendar.DAY_OF_MONTH))
            + "/" + String.valueOf(c.get(Calendar.MONTH) + 1) + "/"
            + String.valueOf(c.get(Calendar.YEAR));

Solution 2:

Implement a Listener Interface in your activity and pass it to the DatePickerFragment. Then trigger the listener by calling it's methods. It's described here: http://developer.android.com/guide/topics/ui/dialogs.html#PassingEvents

Post a Comment for "Android - Date Picker - Obatin Value"