Java tutorial
/* * Copyright (C) 2015-present Saul Cintero <http://www.saulcintero.com>. * * This file is part of MoveOn Sports Tracker. * * MoveOn Sports Tracker is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * MoveOn Sports Tracker is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with MoveOn Sports Tracker. If not, see <http://www.gnu.org/licenses/>. */ package com.saulcintero.moveon.ui.widgets; import android.app.DatePickerDialog; import android.app.DatePickerDialog.OnDateSetListener; import android.app.Dialog; import android.os.Bundle; import android.support.v4.app.DialogFragment; public class myDatePickerDialog extends DialogFragment { OnDateSetListener ondateSet; public void setCallBack(OnDateSetListener ondate) { ondateSet = ondate; } public void setTitle(String t) { title = t; } private int year, month, day; private String title = ""; @Override public void setArguments(Bundle args) { super.setArguments(args); year = args.getInt("year"); month = args.getInt("month"); day = args.getInt("day"); } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { DatePickerDialog dp = new DatePickerDialog(getActivity(), ondateSet, year, month, day); dp.setTitle(title); return dp; } }