Android Date Selector

Source: Internet
Author: User

I saw the date today. Select Open Source project:https://github.com/roomorama/Caldroid

:



Open source projects are developed using studio, and if you use Eclipse to manually import it, you can do it in a common way:

public static SimpleDateFormat formatter = new SimpleDateFormat ("dd MMM yyyy");            
 button Showdialogbutton = (Button) Findviewbyid (R.id.show_dialog_button); Showdialogbutton.setonclicklistener (New Onclicklistener () {@Overridepublic void OnClick (View v) {//Setup caldroid to Use as Dialogdialogcaldroidfragment = new Caldroidfragment ();d Ialogcaldroidfragment.setcaldroidlistener (GetListener ()); Bundle state = savedinstancestate;final String Dialogtag = "Caldroid_dialog_fragment", if (state! = null) {DIALOGCALDROIDF Ragment.restoredialogstatesfromkey (Getsupportfragmentmanager (), state, "Dialog_caldroid_saved_state", DialogTag); Bundle args = Dialogcaldroidfragment.getarguments (); if (args = = null) {args = new Bundle (); Dialogcaldroidfragment.setarguments (args);}} else {//setup Argumentsbundle bundle = new Bundle ();//Setup dialogtitledialogcaldroidfragment.setarguments (bundle);} Dialogcaldroidfragment.show (Getsupportfragmentmanager (), "caldroid_dialog_fragment");}); 
Protected Caldroidlistener Getlistener () {//TODO auto-generated method stub  return new Caldroidlistener () {    @Ov Erride public     void onselectdate (date date, view view) {     //TODO auto-generated method stub     Dialogcaldroidfragment.dismiss ();     Toast.maketext (Getapplicationcontext (), Formatter.format (date), Toast.length_short). Show ();};

It is very useful!! The project uses a third-party jar:date4j if the eclipse integration needs to be downloaded by itself


Android Date Selector

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.