Posts

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 = " @

Android - Intents and Filters

Image
An Android  Intent  is an abstract description of an operation to be performed. It can be used with  startActivity  to launch an Activity,  broadcastIntent  to send it to any interested BroadcastReceiver components, and  startService(Intent) or  bindService(Intent, ServiceConnection, int)  to communicate with a background Service. The intent itself, an Intent object, is a passive data structure holding an abstract description of an operation to be performed. For example, let's assume that you have an Activity that needs to launch an email client and sends an email using your Android device. For this purpose, your Activity would send an ACTION_SEND along with appropriate  chooser , to the Android Intent Resolver. The specified chooser gives the proper interface for the user to pick how to send your email data. Intent email = new Intent ( Intent . ACTION_SEND , Uri . parse ( "mailto:" )); email . putExtra ( Intent . EXTRA_EMAIL , recipients ); email . putExtra