Last active
August 29, 2015 14:20
-
-
Save jonatasleon/04d1eb172530f7c63d75 to your computer and use it in GitHub Desktop.
My date picker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.app.DatePickerDialog; | |
import android.app.Dialog; | |
import android.app.DialogFragment; | |
import android.os.Bundle; | |
import java.util.Calendar; | |
/** | |
* Created by jonatasleon on 02/05/15. | |
*/ | |
public class DatePickerFragment extends DialogFragment { | |
private DatePickerDialog.OnDateSetListener dateSetListener; | |
public void setOnDateSetListener(DatePickerDialog.OnDateSetListener dateSetListener) { | |
this.dateSetListener = dateSetListener; | |
} | |
@Override | |
public Dialog onCreateDialog(Bundle savedInstanceState) { | |
Calendar c = Calendar.getInstance(); | |
int year = c.get(Calendar.YEAR); | |
int month = c.get(Calendar.MONTH); | |
int day = c.get(Calendar.DAY_OF_MONTH); | |
return new DatePickerDialog(getActivity(), dateSetListener, year, month, day); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment