Posts

Showing posts from 2016

Android date picker example

Image
In Android, you can use “ android.widget.DatePicker ” class to render a date picker component to select day, month and year in a pre-defined user interface. In this tutorial, we show you how to render date picker component in current page via  android.widget.DatePicker , and also in dialog box via  android.app.DatePickerDialog . In addition, we also show you how to set a date in date picker component. P.S This project is developed in Eclipse 3.7, and tested with Android 2.3.3. 1. DatePicker Open “ res/layout/main.xml ” file, add date picker, label and button for demonstration. File : res/layout/main.xml <?xml version="1.0" encoding="utf-8"?> < LinearLayout xmlns: android = " http://schemas.android.com/apk/res/android " android: layout_width = " fill_parent " android: layout_height = " fill_parent " android: orientation = " vertical " > < Button android: id = " @