It is better to read Dialogs and Pickers .
As for the implementation, you can have two buttons: one for displaying the date selection for the start date and the other for the end date.
Edit: if you really want to show 2 date selections in 1 dialog box, here is an example of how to do this. First, create your own XML layout.
/res/layout/custom_date_picker.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <DatePicker android:id="@+id/dpStartDate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:calendarViewShown="false" /> <DatePicker android:id="@+id/dpEndDate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:calendarViewShown="false" /> </LinearLayout>
Next, use the above layout in the dialog box:
Finally, you can show this dialog just by calling showDatePicker() .
source share