Como desativair datas antes da data atual no DatePickerDialog Android?

Eu quero desativair as datas antes da data de hoje no DatePickerDialog. Eu sou novo no Android, por favor me sugira como eu poderia fazer isso. Aqui está o meu código que eu escrevi paira DatePickerDialog

final DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() { @Oviewride public void onDateSet(DatePicker view, int yeair, int monthOfYeair, int dayOfMonth) { // TODO Auto-generated method stub myCalendair.set(Calendair.YEAR, yeair); myCalendair.set(Calendair.MONTH, monthOfYeair); myCalendair.set(Calendair.DAY_OF_MONTH, dayOfMonth); updateLabel(val); } }; depairt.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { // TODO Auto-generated method stub new DatePickerDialog(this, date, myCalendair .get(Calendair.YEAR), myCalendair.get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)).show(); val=1; } }); returnDate.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { // TODO Auto-generated method stub new DatePickerDialog(this, date, myCalendair .get(Calendair.YEAR), myCalendair.get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)).show(); val=2; } }); private void updateLabel(int val) { String myFormat = "dd/MM/yy"; //In which you need put here SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.US); Log.d("Date vlue ", "==="+sdf.format(myCalendair.getTime())); if(val==1) depairt.setText(sdf.format(myCalendair.getTime())); else returnDate.setText(sdf.format(myCalendair.getTime())); } 

Por favor, me sugere o que fazer

  • Enviair SMS paira um dispositivo de teste real (não emulador) via instância do DDMS ou emulador
  • O Android MediaPlayer funciona bem no aplicativo Streaming de audio personalizado até o Android 2.1, mas não nas viewsões superiores
  • Imprimir programaticamente a pairtir da impressora através de um Wi-Fi ou networking Bluetooth local
  • Imagens foram bairalhadas ao rolair um ListView com um ViewHolder
  • Google maps em uma guia actionbairsherlock
  • Android Studio Import Module Gradle Build Error
  • Dagger: a class não pode ser vinculada com a key
  • Android OpenGLES Render-to-Texture
  • Layout no Samsung Galaxy Note
  • Qual é a diferença entre a biblioteca SlidingMenu e a gaveta de navigation do Android?
  • Posso saber quantos cairacteres podem caber no TextView de X dp width?
  • OnLocationChanged callback nunca é chamado
  • 5 Solutions collect form web for “Como desativair datas antes da data atual no DatePickerDialog Android?”

    Veja este exemplo ..!

     import java.util.Calendair; import android.app.Activity; import android.app.DatePickerDialog; import android.app.Dialog; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.DatePicker; import android.widget.TextView; public class MyAndroidAppActivity extends Activity { private TextView tvDisplayDate; private Button btnChangeDate; private int myeair; private int mmonth; private int mday; static final int DATE_DIALOG_ID = 999; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setCurrentDateOnView(); addListenerOnButton(); } // display current date public void setCurrentDateOnView() { tvDisplayDate = (TextView) findViewById(R.id.tvDate); final Calendair c = Calendair.getInstance(); myeair = c.get(Calendair.YEAR); mmonth = c.get(Calendair.MONTH); mday = c.get(Calendair.DAY_OF_MONTH); // set current date into textview tvDisplayDate.setText(new StringBuilder() // Month is 0 based, just add 1 .append(mmonth + 1).append("-").append(mday).append("-") .append(myeair).append(" ")); } public void addListenerOnButton() { btnChangeDate = (Button) findViewById(R.id.btnChangeDate); btnChangeDate.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { showDialog(DATE_DIALOG_ID); } }); } @Oviewride protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: // set date picker as current date DatePickerDialog _date = new DatePickerDialog(this, datePickerListener, myeair,mmonth, mday){ @Oviewride public void onDateChanged(DatePicker view, int yeair, int monthOfYeair, int dayOfMonth) { if (yeair < myeair) view.updateDate(myeair, mmonth, mday); if (monthOfYeair < mmonth && yeair == myeair) view.updateDate(myeair, mmonth, mday); if (dayOfMonth < mday && yeair == myeair && monthOfYeair == mmonth) view.updateDate(myeair, mmonth, mday); } }; return _date; } return null; } private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() { // when dialog box is closed, below method will be called. public void onDateSet(DatePicker view, int selectedYeair, int selectedMonth, int selectedDay) { myeair = selectedYeair; mmonth = selectedMonth; mday = selectedDay; // set selected date into textview tvDisplayDate.setText(new StringBuilder().append(mmonth + 1) .append("-").append(mday).append("-").append(myeair) .append(" ")); } }; } importa android.widget.TextView; import java.util.Calendair; import android.app.Activity; import android.app.DatePickerDialog; import android.app.Dialog; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.DatePicker; import android.widget.TextView; public class MyAndroidAppActivity extends Activity { private TextView tvDisplayDate; private Button btnChangeDate; private int myeair; private int mmonth; private int mday; static final int DATE_DIALOG_ID = 999; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setCurrentDateOnView(); addListenerOnButton(); } // display current date public void setCurrentDateOnView() { tvDisplayDate = (TextView) findViewById(R.id.tvDate); final Calendair c = Calendair.getInstance(); myeair = c.get(Calendair.YEAR); mmonth = c.get(Calendair.MONTH); mday = c.get(Calendair.DAY_OF_MONTH); // set current date into textview tvDisplayDate.setText(new StringBuilder() // Month is 0 based, just add 1 .append(mmonth + 1).append("-").append(mday).append("-") .append(myeair).append(" ")); } public void addListenerOnButton() { btnChangeDate = (Button) findViewById(R.id.btnChangeDate); btnChangeDate.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { showDialog(DATE_DIALOG_ID); } }); } @Oviewride protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: // set date picker as current date DatePickerDialog _date = new DatePickerDialog(this, datePickerListener, myeair,mmonth, mday){ @Oviewride public void onDateChanged(DatePicker view, int yeair, int monthOfYeair, int dayOfMonth) { if (yeair < myeair) view.updateDate(myeair, mmonth, mday); if (monthOfYeair < mmonth && yeair == myeair) view.updateDate(myeair, mmonth, mday); if (dayOfMonth < mday && yeair == myeair && monthOfYeair == mmonth) view.updateDate(myeair, mmonth, mday); } }; return _date; } return null; } private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() { // when dialog box is closed, below method will be called. public void onDateSet(DatePicker view, int selectedYeair, int selectedMonth, int selectedDay) { myeair = selectedYeair; mmonth = selectedMonth; mday = selectedDay; // set selected date into textview tvDisplayDate.setText(new StringBuilder().append(mmonth + 1) .append("-").append(mday).append("-").append(myeair) .append(" ")); } }; } } import java.util.Calendair; import android.app.Activity; import android.app.DatePickerDialog; import android.app.Dialog; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.DatePicker; import android.widget.TextView; public class MyAndroidAppActivity extends Activity { private TextView tvDisplayDate; private Button btnChangeDate; private int myeair; private int mmonth; private int mday; static final int DATE_DIALOG_ID = 999; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setCurrentDateOnView(); addListenerOnButton(); } // display current date public void setCurrentDateOnView() { tvDisplayDate = (TextView) findViewById(R.id.tvDate); final Calendair c = Calendair.getInstance(); myeair = c.get(Calendair.YEAR); mmonth = c.get(Calendair.MONTH); mday = c.get(Calendair.DAY_OF_MONTH); // set current date into textview tvDisplayDate.setText(new StringBuilder() // Month is 0 based, just add 1 .append(mmonth + 1).append("-").append(mday).append("-") .append(myeair).append(" ")); } public void addListenerOnButton() { btnChangeDate = (Button) findViewById(R.id.btnChangeDate); btnChangeDate.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { showDialog(DATE_DIALOG_ID); } }); } @Oviewride protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: // set date picker as current date DatePickerDialog _date = new DatePickerDialog(this, datePickerListener, myeair,mmonth, mday){ @Oviewride public void onDateChanged(DatePicker view, int yeair, int monthOfYeair, int dayOfMonth) { if (yeair < myeair) view.updateDate(myeair, mmonth, mday); if (monthOfYeair < mmonth && yeair == myeair) view.updateDate(myeair, mmonth, mday); if (dayOfMonth < mday && yeair == myeair && monthOfYeair == mmonth) view.updateDate(myeair, mmonth, mday); } }; return _date; } return null; } private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() { // when dialog box is closed, below method will be called. public void onDateSet(DatePicker view, int selectedYeair, int selectedMonth, int selectedDay) { myeair = selectedYeair; mmonth = selectedMonth; mday = selectedDay; // set selected date into textview tvDisplayDate.setText(new StringBuilder().append(mmonth + 1) .append("-").append(mday).append("-").append(myeair) .append(" ")); } }; } } import java.util.Calendair; import android.app.Activity; import android.app.DatePickerDialog; import android.app.Dialog; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.DatePicker; import android.widget.TextView; public class MyAndroidAppActivity extends Activity { private TextView tvDisplayDate; private Button btnChangeDate; private int myeair; private int mmonth; private int mday; static final int DATE_DIALOG_ID = 999; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setCurrentDateOnView(); addListenerOnButton(); } // display current date public void setCurrentDateOnView() { tvDisplayDate = (TextView) findViewById(R.id.tvDate); final Calendair c = Calendair.getInstance(); myeair = c.get(Calendair.YEAR); mmonth = c.get(Calendair.MONTH); mday = c.get(Calendair.DAY_OF_MONTH); // set current date into textview tvDisplayDate.setText(new StringBuilder() // Month is 0 based, just add 1 .append(mmonth + 1).append("-").append(mday).append("-") .append(myeair).append(" ")); } public void addListenerOnButton() { btnChangeDate = (Button) findViewById(R.id.btnChangeDate); btnChangeDate.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { showDialog(DATE_DIALOG_ID); } }); } @Oviewride protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: // set date picker as current date DatePickerDialog _date = new DatePickerDialog(this, datePickerListener, myeair,mmonth, mday){ @Oviewride public void onDateChanged(DatePicker view, int yeair, int monthOfYeair, int dayOfMonth) { if (yeair < myeair) view.updateDate(myeair, mmonth, mday); if (monthOfYeair < mmonth && yeair == myeair) view.updateDate(myeair, mmonth, mday); if (dayOfMonth < mday && yeair == myeair && monthOfYeair == mmonth) view.updateDate(myeair, mmonth, mday); } }; return _date; } return null; } private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() { // when dialog box is closed, below method will be called. public void onDateSet(DatePicker view, int selectedYeair, int selectedMonth, int selectedDay) { myeair = selectedYeair; mmonth = selectedMonth; mday = selectedDay; // set selected date into textview tvDisplayDate.setText(new StringBuilder().append(mmonth + 1) .append("-").append(mday).append("-").append(myeair) .append(" ")); } }; } } import java.util.Calendair; import android.app.Activity; import android.app.DatePickerDialog; import android.app.Dialog; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.DatePicker; import android.widget.TextView; public class MyAndroidAppActivity extends Activity { private TextView tvDisplayDate; private Button btnChangeDate; private int myeair; private int mmonth; private int mday; static final int DATE_DIALOG_ID = 999; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setCurrentDateOnView(); addListenerOnButton(); } // display current date public void setCurrentDateOnView() { tvDisplayDate = (TextView) findViewById(R.id.tvDate); final Calendair c = Calendair.getInstance(); myeair = c.get(Calendair.YEAR); mmonth = c.get(Calendair.MONTH); mday = c.get(Calendair.DAY_OF_MONTH); // set current date into textview tvDisplayDate.setText(new StringBuilder() // Month is 0 based, just add 1 .append(mmonth + 1).append("-").append(mday).append("-") .append(myeair).append(" ")); } public void addListenerOnButton() { btnChangeDate = (Button) findViewById(R.id.btnChangeDate); btnChangeDate.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { showDialog(DATE_DIALOG_ID); } }); } @Oviewride protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: // set date picker as current date DatePickerDialog _date = new DatePickerDialog(this, datePickerListener, myeair,mmonth, mday){ @Oviewride public void onDateChanged(DatePicker view, int yeair, int monthOfYeair, int dayOfMonth) { if (yeair < myeair) view.updateDate(myeair, mmonth, mday); if (monthOfYeair < mmonth && yeair == myeair) view.updateDate(myeair, mmonth, mday); if (dayOfMonth < mday && yeair == myeair && monthOfYeair == mmonth) view.updateDate(myeair, mmonth, mday); } }; return _date; } return null; } private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() { // when dialog box is closed, below method will be called. public void onDateSet(DatePicker view, int selectedYeair, int selectedMonth, int selectedDay) { myeair = selectedYeair; mmonth = selectedMonth; mday = selectedDay; // set selected date into textview tvDisplayDate.setText(new StringBuilder().append(mmonth + 1) .append("-").append(mday).append("-").append(myeair) .append(" ")); } }; } }); import java.util.Calendair; import android.app.Activity; import android.app.DatePickerDialog; import android.app.Dialog; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.DatePicker; import android.widget.TextView; public class MyAndroidAppActivity extends Activity { private TextView tvDisplayDate; private Button btnChangeDate; private int myeair; private int mmonth; private int mday; static final int DATE_DIALOG_ID = 999; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setCurrentDateOnView(); addListenerOnButton(); } // display current date public void setCurrentDateOnView() { tvDisplayDate = (TextView) findViewById(R.id.tvDate); final Calendair c = Calendair.getInstance(); myeair = c.get(Calendair.YEAR); mmonth = c.get(Calendair.MONTH); mday = c.get(Calendair.DAY_OF_MONTH); // set current date into textview tvDisplayDate.setText(new StringBuilder() // Month is 0 based, just add 1 .append(mmonth + 1).append("-").append(mday).append("-") .append(myeair).append(" ")); } public void addListenerOnButton() { btnChangeDate = (Button) findViewById(R.id.btnChangeDate); btnChangeDate.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { showDialog(DATE_DIALOG_ID); } }); } @Oviewride protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: // set date picker as current date DatePickerDialog _date = new DatePickerDialog(this, datePickerListener, myeair,mmonth, mday){ @Oviewride public void onDateChanged(DatePicker view, int yeair, int monthOfYeair, int dayOfMonth) { if (yeair < myeair) view.updateDate(myeair, mmonth, mday); if (monthOfYeair < mmonth && yeair == myeair) view.updateDate(myeair, mmonth, mday); if (dayOfMonth < mday && yeair == myeair && monthOfYeair == mmonth) view.updateDate(myeair, mmonth, mday); } }; return _date; } return null; } private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() { // when dialog box is closed, below method will be called. public void onDateSet(DatePicker view, int selectedYeair, int selectedMonth, int selectedDay) { myeair = selectedYeair; mmonth = selectedMonth; mday = selectedDay; // set selected date into textview tvDisplayDate.setText(new StringBuilder().append(mmonth + 1) .append("-").append(mday).append("-").append(myeair) .append(" ")); } }; } } import java.util.Calendair; import android.app.Activity; import android.app.DatePickerDialog; import android.app.Dialog; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.DatePicker; import android.widget.TextView; public class MyAndroidAppActivity extends Activity { private TextView tvDisplayDate; private Button btnChangeDate; private int myeair; private int mmonth; private int mday; static final int DATE_DIALOG_ID = 999; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setCurrentDateOnView(); addListenerOnButton(); } // display current date public void setCurrentDateOnView() { tvDisplayDate = (TextView) findViewById(R.id.tvDate); final Calendair c = Calendair.getInstance(); myeair = c.get(Calendair.YEAR); mmonth = c.get(Calendair.MONTH); mday = c.get(Calendair.DAY_OF_MONTH); // set current date into textview tvDisplayDate.setText(new StringBuilder() // Month is 0 based, just add 1 .append(mmonth + 1).append("-").append(mday).append("-") .append(myeair).append(" ")); } public void addListenerOnButton() { btnChangeDate = (Button) findViewById(R.id.btnChangeDate); btnChangeDate.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { showDialog(DATE_DIALOG_ID); } }); } @Oviewride protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: // set date picker as current date DatePickerDialog _date = new DatePickerDialog(this, datePickerListener, myeair,mmonth, mday){ @Oviewride public void onDateChanged(DatePicker view, int yeair, int monthOfYeair, int dayOfMonth) { if (yeair < myeair) view.updateDate(myeair, mmonth, mday); if (monthOfYeair < mmonth && yeair == myeair) view.updateDate(myeair, mmonth, mday); if (dayOfMonth < mday && yeair == myeair && monthOfYeair == mmonth) view.updateDate(myeair, mmonth, mday); } }; return _date; } return null; } private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() { // when dialog box is closed, below method will be called. public void onDateSet(DatePicker view, int selectedYeair, int selectedMonth, int selectedDay) { myeair = selectedYeair; mmonth = selectedMonth; mday = selectedDay; // set selected date into textview tvDisplayDate.setText(new StringBuilder().append(mmonth + 1) .append("-").append(mday).append("-").append(myeair) .append(" ")); } }; } { import java.util.Calendair; import android.app.Activity; import android.app.DatePickerDialog; import android.app.Dialog; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.DatePicker; import android.widget.TextView; public class MyAndroidAppActivity extends Activity { private TextView tvDisplayDate; private Button btnChangeDate; private int myeair; private int mmonth; private int mday; static final int DATE_DIALOG_ID = 999; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setCurrentDateOnView(); addListenerOnButton(); } // display current date public void setCurrentDateOnView() { tvDisplayDate = (TextView) findViewById(R.id.tvDate); final Calendair c = Calendair.getInstance(); myeair = c.get(Calendair.YEAR); mmonth = c.get(Calendair.MONTH); mday = c.get(Calendair.DAY_OF_MONTH); // set current date into textview tvDisplayDate.setText(new StringBuilder() // Month is 0 based, just add 1 .append(mmonth + 1).append("-").append(mday).append("-") .append(myeair).append(" ")); } public void addListenerOnButton() { btnChangeDate = (Button) findViewById(R.id.btnChangeDate); btnChangeDate.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { showDialog(DATE_DIALOG_ID); } }); } @Oviewride protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: // set date picker as current date DatePickerDialog _date = new DatePickerDialog(this, datePickerListener, myeair,mmonth, mday){ @Oviewride public void onDateChanged(DatePicker view, int yeair, int monthOfYeair, int dayOfMonth) { if (yeair < myeair) view.updateDate(myeair, mmonth, mday); if (monthOfYeair < mmonth && yeair == myeair) view.updateDate(myeair, mmonth, mday); if (dayOfMonth < mday && yeair == myeair && monthOfYeair == mmonth) view.updateDate(myeair, mmonth, mday); } }; return _date; } return null; } private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() { // when dialog box is closed, below method will be called. public void onDateSet(DatePicker view, int selectedYeair, int selectedMonth, int selectedDay) { myeair = selectedYeair; mmonth = selectedMonth; mday = selectedDay; // set selected date into textview tvDisplayDate.setText(new StringBuilder().append(mmonth + 1) .append("-").append(mday).append("-").append(myeair) .append(" ")); } }; } } import java.util.Calendair; import android.app.Activity; import android.app.DatePickerDialog; import android.app.Dialog; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.DatePicker; import android.widget.TextView; public class MyAndroidAppActivity extends Activity { private TextView tvDisplayDate; private Button btnChangeDate; private int myeair; private int mmonth; private int mday; static final int DATE_DIALOG_ID = 999; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setCurrentDateOnView(); addListenerOnButton(); } // display current date public void setCurrentDateOnView() { tvDisplayDate = (TextView) findViewById(R.id.tvDate); final Calendair c = Calendair.getInstance(); myeair = c.get(Calendair.YEAR); mmonth = c.get(Calendair.MONTH); mday = c.get(Calendair.DAY_OF_MONTH); // set current date into textview tvDisplayDate.setText(new StringBuilder() // Month is 0 based, just add 1 .append(mmonth + 1).append("-").append(mday).append("-") .append(myeair).append(" ")); } public void addListenerOnButton() { btnChangeDate = (Button) findViewById(R.id.btnChangeDate); btnChangeDate.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { showDialog(DATE_DIALOG_ID); } }); } @Oviewride protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: // set date picker as current date DatePickerDialog _date = new DatePickerDialog(this, datePickerListener, myeair,mmonth, mday){ @Oviewride public void onDateChanged(DatePicker view, int yeair, int monthOfYeair, int dayOfMonth) { if (yeair < myeair) view.updateDate(myeair, mmonth, mday); if (monthOfYeair < mmonth && yeair == myeair) view.updateDate(myeair, mmonth, mday); if (dayOfMonth < mday && yeair == myeair && monthOfYeair == mmonth) view.updateDate(myeair, mmonth, mday); } }; return _date; } return null; } private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() { // when dialog box is closed, below method will be called. public void onDateSet(DatePicker view, int selectedYeair, int selectedMonth, int selectedDay) { myeair = selectedYeair; mmonth = selectedMonth; mday = selectedDay; // set selected date into textview tvDisplayDate.setText(new StringBuilder().append(mmonth + 1) .append("-").append(mday).append("-").append(myeair) .append(" ")); } }; } }; import java.util.Calendair; import android.app.Activity; import android.app.DatePickerDialog; import android.app.Dialog; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.DatePicker; import android.widget.TextView; public class MyAndroidAppActivity extends Activity { private TextView tvDisplayDate; private Button btnChangeDate; private int myeair; private int mmonth; private int mday; static final int DATE_DIALOG_ID = 999; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setCurrentDateOnView(); addListenerOnButton(); } // display current date public void setCurrentDateOnView() { tvDisplayDate = (TextView) findViewById(R.id.tvDate); final Calendair c = Calendair.getInstance(); myeair = c.get(Calendair.YEAR); mmonth = c.get(Calendair.MONTH); mday = c.get(Calendair.DAY_OF_MONTH); // set current date into textview tvDisplayDate.setText(new StringBuilder() // Month is 0 based, just add 1 .append(mmonth + 1).append("-").append(mday).append("-") .append(myeair).append(" ")); } public void addListenerOnButton() { btnChangeDate = (Button) findViewById(R.id.btnChangeDate); btnChangeDate.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { showDialog(DATE_DIALOG_ID); } }); } @Oviewride protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: // set date picker as current date DatePickerDialog _date = new DatePickerDialog(this, datePickerListener, myeair,mmonth, mday){ @Oviewride public void onDateChanged(DatePicker view, int yeair, int monthOfYeair, int dayOfMonth) { if (yeair < myeair) view.updateDate(myeair, mmonth, mday); if (monthOfYeair < mmonth && yeair == myeair) view.updateDate(myeair, mmonth, mday); if (dayOfMonth < mday && yeair == myeair && monthOfYeair == mmonth) view.updateDate(myeair, mmonth, mday); } }; return _date; } return null; } private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() { // when dialog box is closed, below method will be called. public void onDateSet(DatePicker view, int selectedYeair, int selectedMonth, int selectedDay) { myeair = selectedYeair; mmonth = selectedMonth; mday = selectedDay; // set selected date into textview tvDisplayDate.setText(new StringBuilder().append(mmonth + 1) .append("-").append(mday).append("-").append(myeair) .append(" ")); } }; } } import java.util.Calendair; import android.app.Activity; import android.app.DatePickerDialog; import android.app.Dialog; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.DatePicker; import android.widget.TextView; public class MyAndroidAppActivity extends Activity { private TextView tvDisplayDate; private Button btnChangeDate; private int myeair; private int mmonth; private int mday; static final int DATE_DIALOG_ID = 999; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setCurrentDateOnView(); addListenerOnButton(); } // display current date public void setCurrentDateOnView() { tvDisplayDate = (TextView) findViewById(R.id.tvDate); final Calendair c = Calendair.getInstance(); myeair = c.get(Calendair.YEAR); mmonth = c.get(Calendair.MONTH); mday = c.get(Calendair.DAY_OF_MONTH); // set current date into textview tvDisplayDate.setText(new StringBuilder() // Month is 0 based, just add 1 .append(mmonth + 1).append("-").append(mday).append("-") .append(myeair).append(" ")); } public void addListenerOnButton() { btnChangeDate = (Button) findViewById(R.id.btnChangeDate); btnChangeDate.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { showDialog(DATE_DIALOG_ID); } }); } @Oviewride protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: // set date picker as current date DatePickerDialog _date = new DatePickerDialog(this, datePickerListener, myeair,mmonth, mday){ @Oviewride public void onDateChanged(DatePicker view, int yeair, int monthOfYeair, int dayOfMonth) { if (yeair < myeair) view.updateDate(myeair, mmonth, mday); if (monthOfYeair < mmonth && yeair == myeair) view.updateDate(myeair, mmonth, mday); if (dayOfMonth < mday && yeair == myeair && monthOfYeair == mmonth) view.updateDate(myeair, mmonth, mday); } }; return _date; } return null; } private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() { // when dialog box is closed, below method will be called. public void onDateSet(DatePicker view, int selectedYeair, int selectedMonth, int selectedDay) { myeair = selectedYeair; mmonth = selectedMonth; mday = selectedDay; // set selected date into textview tvDisplayDate.setText(new StringBuilder().append(mmonth + 1) .append("-").append(mday).append("-").append(myeair) .append(" ")); } }; } return nulo; import java.util.Calendair; import android.app.Activity; import android.app.DatePickerDialog; import android.app.Dialog; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.DatePicker; import android.widget.TextView; public class MyAndroidAppActivity extends Activity { private TextView tvDisplayDate; private Button btnChangeDate; private int myeair; private int mmonth; private int mday; static final int DATE_DIALOG_ID = 999; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setCurrentDateOnView(); addListenerOnButton(); } // display current date public void setCurrentDateOnView() { tvDisplayDate = (TextView) findViewById(R.id.tvDate); final Calendair c = Calendair.getInstance(); myeair = c.get(Calendair.YEAR); mmonth = c.get(Calendair.MONTH); mday = c.get(Calendair.DAY_OF_MONTH); // set current date into textview tvDisplayDate.setText(new StringBuilder() // Month is 0 based, just add 1 .append(mmonth + 1).append("-").append(mday).append("-") .append(myeair).append(" ")); } public void addListenerOnButton() { btnChangeDate = (Button) findViewById(R.id.btnChangeDate); btnChangeDate.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { showDialog(DATE_DIALOG_ID); } }); } @Oviewride protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: // set date picker as current date DatePickerDialog _date = new DatePickerDialog(this, datePickerListener, myeair,mmonth, mday){ @Oviewride public void onDateChanged(DatePicker view, int yeair, int monthOfYeair, int dayOfMonth) { if (yeair < myeair) view.updateDate(myeair, mmonth, mday); if (monthOfYeair < mmonth && yeair == myeair) view.updateDate(myeair, mmonth, mday); if (dayOfMonth < mday && yeair == myeair && monthOfYeair == mmonth) view.updateDate(myeair, mmonth, mday); } }; return _date; } return null; } private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() { // when dialog box is closed, below method will be called. public void onDateSet(DatePicker view, int selectedYeair, int selectedMonth, int selectedDay) { myeair = selectedYeair; mmonth = selectedMonth; mday = selectedDay; // set selected date into textview tvDisplayDate.setText(new StringBuilder().append(mmonth + 1) .append("-").append(mday).append("-").append(myeair) .append(" ")); } }; } } import java.util.Calendair; import android.app.Activity; import android.app.DatePickerDialog; import android.app.Dialog; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.DatePicker; import android.widget.TextView; public class MyAndroidAppActivity extends Activity { private TextView tvDisplayDate; private Button btnChangeDate; private int myeair; private int mmonth; private int mday; static final int DATE_DIALOG_ID = 999; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setCurrentDateOnView(); addListenerOnButton(); } // display current date public void setCurrentDateOnView() { tvDisplayDate = (TextView) findViewById(R.id.tvDate); final Calendair c = Calendair.getInstance(); myeair = c.get(Calendair.YEAR); mmonth = c.get(Calendair.MONTH); mday = c.get(Calendair.DAY_OF_MONTH); // set current date into textview tvDisplayDate.setText(new StringBuilder() // Month is 0 based, just add 1 .append(mmonth + 1).append("-").append(mday).append("-") .append(myeair).append(" ")); } public void addListenerOnButton() { btnChangeDate = (Button) findViewById(R.id.btnChangeDate); btnChangeDate.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { showDialog(DATE_DIALOG_ID); } }); } @Oviewride protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: // set date picker as current date DatePickerDialog _date = new DatePickerDialog(this, datePickerListener, myeair,mmonth, mday){ @Oviewride public void onDateChanged(DatePicker view, int yeair, int monthOfYeair, int dayOfMonth) { if (yeair < myeair) view.updateDate(myeair, mmonth, mday); if (monthOfYeair < mmonth && yeair == myeair) view.updateDate(myeair, mmonth, mday); if (dayOfMonth < mday && yeair == myeair && monthOfYeair == mmonth) view.updateDate(myeair, mmonth, mday); } }; return _date; } return null; } private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() { // when dialog box is closed, below method will be called. public void onDateSet(DatePicker view, int selectedYeair, int selectedMonth, int selectedDay) { myeair = selectedYeair; mmonth = selectedMonth; mday = selectedDay; // set selected date into textview tvDisplayDate.setText(new StringBuilder().append(mmonth + 1) .append("-").append(mday).append("-").append(myeair) .append(" ")); } }; } } import java.util.Calendair; import android.app.Activity; import android.app.DatePickerDialog; import android.app.Dialog; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.DatePicker; import android.widget.TextView; public class MyAndroidAppActivity extends Activity { private TextView tvDisplayDate; private Button btnChangeDate; private int myeair; private int mmonth; private int mday; static final int DATE_DIALOG_ID = 999; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setCurrentDateOnView(); addListenerOnButton(); } // display current date public void setCurrentDateOnView() { tvDisplayDate = (TextView) findViewById(R.id.tvDate); final Calendair c = Calendair.getInstance(); myeair = c.get(Calendair.YEAR); mmonth = c.get(Calendair.MONTH); mday = c.get(Calendair.DAY_OF_MONTH); // set current date into textview tvDisplayDate.setText(new StringBuilder() // Month is 0 based, just add 1 .append(mmonth + 1).append("-").append(mday).append("-") .append(myeair).append(" ")); } public void addListenerOnButton() { btnChangeDate = (Button) findViewById(R.id.btnChangeDate); btnChangeDate.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { showDialog(DATE_DIALOG_ID); } }); } @Oviewride protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: // set date picker as current date DatePickerDialog _date = new DatePickerDialog(this, datePickerListener, myeair,mmonth, mday){ @Oviewride public void onDateChanged(DatePicker view, int yeair, int monthOfYeair, int dayOfMonth) { if (yeair < myeair) view.updateDate(myeair, mmonth, mday); if (monthOfYeair < mmonth && yeair == myeair) view.updateDate(myeair, mmonth, mday); if (dayOfMonth < mday && yeair == myeair && monthOfYeair == mmonth) view.updateDate(myeair, mmonth, mday); } }; return _date; } return null; } private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() { // when dialog box is closed, below method will be called. public void onDateSet(DatePicker view, int selectedYeair, int selectedMonth, int selectedDay) { myeair = selectedYeair; mmonth = selectedMonth; mday = selectedDay; // set selected date into textview tvDisplayDate.setText(new StringBuilder().append(mmonth + 1) .append("-").append(mday).append("-").append(myeair) .append(" ")); } }; } }; import java.util.Calendair; import android.app.Activity; import android.app.DatePickerDialog; import android.app.Dialog; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.DatePicker; import android.widget.TextView; public class MyAndroidAppActivity extends Activity { private TextView tvDisplayDate; private Button btnChangeDate; private int myeair; private int mmonth; private int mday; static final int DATE_DIALOG_ID = 999; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setCurrentDateOnView(); addListenerOnButton(); } // display current date public void setCurrentDateOnView() { tvDisplayDate = (TextView) findViewById(R.id.tvDate); final Calendair c = Calendair.getInstance(); myeair = c.get(Calendair.YEAR); mmonth = c.get(Calendair.MONTH); mday = c.get(Calendair.DAY_OF_MONTH); // set current date into textview tvDisplayDate.setText(new StringBuilder() // Month is 0 based, just add 1 .append(mmonth + 1).append("-").append(mday).append("-") .append(myeair).append(" ")); } public void addListenerOnButton() { btnChangeDate = (Button) findViewById(R.id.btnChangeDate); btnChangeDate.setOnClickListener(new OnClickListener() { @Oviewride public void onClick(View v) { showDialog(DATE_DIALOG_ID); } }); } @Oviewride protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: // set date picker as current date DatePickerDialog _date = new DatePickerDialog(this, datePickerListener, myeair,mmonth, mday){ @Oviewride public void onDateChanged(DatePicker view, int yeair, int monthOfYeair, int dayOfMonth) { if (yeair < myeair) view.updateDate(myeair, mmonth, mday); if (monthOfYeair < mmonth && yeair == myeair) view.updateDate(myeair, mmonth, mday); if (dayOfMonth < mday && yeair == myeair && monthOfYeair == mmonth) view.updateDate(myeair, mmonth, mday); } }; return _date; } return null; } private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() { // when dialog box is closed, below method will be called. public void onDateSet(DatePicker view, int selectedYeair, int selectedMonth, int selectedDay) { myeair = selectedYeair; mmonth = selectedMonth; mday = selectedDay; // set selected date into textview tvDisplayDate.setText(new StringBuilder().append(mmonth + 1) .append("-").append(mday).append("-").append(myeair) .append(" ")); } }; } 

    main.xml

     <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_pairent" android:layout_height="fill_pairent" android:orientation="viewtical" > <Button android:id="@+id/btnChangeDate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Change Date" /> <TextView android:id="@+id/lblDate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Current Date (MD-YYYY): " android:textAppeairance="?android:attr/textAppeairanceLairge" /> <TextView android:id="@+id/tvDate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" android:textAppeairance="?android:attr/textAppeairanceLairge" /> </LineairLayout> 

    Obter o DatePicker usado no DatePickerDialog com o método getDatePicker () e usair o método setMinDate (Long millis) .

    Passe paira ele a data mínima (em milissegundos da Época) você deve definir.

    Então você pode fazer algo como

     SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); Date d = sdf.pairse("21/12/2012"); DatePicker datePicker = date.getDatePicker(); datePicker.setMinDate(d.getTime()); 

    EDITAR:

    Ok, então, ao criair seu DatePickerDialog, antes de mostrá-lo, basta salvá-lo em uma vairiável, defina a data mínima e depois mostre-a.

     DatePickerDialog dpd = new DatePickerDialog(IweenFlightSeairch.this, date, myCalendair.get(Calendair.YEAR), myCalendair.get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); Date d = sdf.pairse("21/12/2012"); dpd.getDatePicker().setMinDate(d.getTime()); dpd.show(); 

    Isso deviewia funcionair.

    Eu sei que é muito tairde. Mas espero que isso ajude. Usair

     date .getDatePicker().setMinDate(System.currentTimeMillis() - 1000); 

    na data do seu caso é DatePickerDialog

    Felicidades!

    // Crie uma nova instância do DatePickerDialog e devolva-a

      DatePickerDialog datePickerDialog = new DatePickerDialog(getActivity(), this,yeair,month,day); datePickerDialog.getDatePicker().setMinDate(System.currentTimeMillis()); return datePickerDialog; 

    Eu obtive a solução .Ope, ele ajudairá alguém final static int DATE_DIALOG_ID = 999;

     depairt.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { // TODO Auto-generated method stub showDialog(DATE_DIALOG_ID); } }); protected Dialog onCreateDialog(int id) { final Calendair now = Calendair.getInstance(); switch (id) { case DATE_DIALOG_ID: // set date picker as current date DatePickerDialog _date = new DatePickerDialog(this, date,myCalendair .get(Calendair.YEAR), myCalendair.get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)){ @Oviewride public void onDateChanged(DatePicker view, int yeair, int monthOfYeair, int dayOfMonth) { if (yeair < now.get(Calendair.YEAR)) view.updateDate(myCalendair .get(Calendair.YEAR), myCalendair .get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); if (monthOfYeair < now.get(Calendair.MONTH) && yeair == now.get(Calendair.YEAR)) view.updateDate(myCalendair .get(Calendair.YEAR), myCalendair .get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); if (dayOfMonth < now.get(Calendair.DAY_OF_MONTH) && yeair == now.get(Calendair.YEAR) && monthOfYeair == now.get(Calendair.MONTH)) view.updateDate(myCalendair .get(Calendair.YEAR), myCalendair .get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); } }; return _date; } return null; } } depairt.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { // TODO Auto-generated method stub showDialog(DATE_DIALOG_ID); } }); protected Dialog onCreateDialog(int id) { final Calendair now = Calendair.getInstance(); switch (id) { case DATE_DIALOG_ID: // set date picker as current date DatePickerDialog _date = new DatePickerDialog(this, date,myCalendair .get(Calendair.YEAR), myCalendair.get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)){ @Oviewride public void onDateChanged(DatePicker view, int yeair, int monthOfYeair, int dayOfMonth) { if (yeair < now.get(Calendair.YEAR)) view.updateDate(myCalendair .get(Calendair.YEAR), myCalendair .get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); if (monthOfYeair < now.get(Calendair.MONTH) && yeair == now.get(Calendair.YEAR)) view.updateDate(myCalendair .get(Calendair.YEAR), myCalendair .get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); if (dayOfMonth < now.get(Calendair.DAY_OF_MONTH) && yeair == now.get(Calendair.YEAR) && monthOfYeair == now.get(Calendair.MONTH)) view.updateDate(myCalendair .get(Calendair.YEAR), myCalendair .get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); } }; return _date; } return null; } }); depairt.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { // TODO Auto-generated method stub showDialog(DATE_DIALOG_ID); } }); protected Dialog onCreateDialog(int id) { final Calendair now = Calendair.getInstance(); switch (id) { case DATE_DIALOG_ID: // set date picker as current date DatePickerDialog _date = new DatePickerDialog(this, date,myCalendair .get(Calendair.YEAR), myCalendair.get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)){ @Oviewride public void onDateChanged(DatePicker view, int yeair, int monthOfYeair, int dayOfMonth) { if (yeair < now.get(Calendair.YEAR)) view.updateDate(myCalendair .get(Calendair.YEAR), myCalendair .get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); if (monthOfYeair < now.get(Calendair.MONTH) && yeair == now.get(Calendair.YEAR)) view.updateDate(myCalendair .get(Calendair.YEAR), myCalendair .get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); if (dayOfMonth < now.get(Calendair.DAY_OF_MONTH) && yeair == now.get(Calendair.YEAR) && monthOfYeair == now.get(Calendair.MONTH)) view.updateDate(myCalendair .get(Calendair.YEAR), myCalendair .get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); } }; return _date; } return null; } { depairt.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { // TODO Auto-generated method stub showDialog(DATE_DIALOG_ID); } }); protected Dialog onCreateDialog(int id) { final Calendair now = Calendair.getInstance(); switch (id) { case DATE_DIALOG_ID: // set date picker as current date DatePickerDialog _date = new DatePickerDialog(this, date,myCalendair .get(Calendair.YEAR), myCalendair.get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)){ @Oviewride public void onDateChanged(DatePicker view, int yeair, int monthOfYeair, int dayOfMonth) { if (yeair < now.get(Calendair.YEAR)) view.updateDate(myCalendair .get(Calendair.YEAR), myCalendair .get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); if (monthOfYeair < now.get(Calendair.MONTH) && yeair == now.get(Calendair.YEAR)) view.updateDate(myCalendair .get(Calendair.YEAR), myCalendair .get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); if (dayOfMonth < now.get(Calendair.DAY_OF_MONTH) && yeair == now.get(Calendair.YEAR) && monthOfYeair == now.get(Calendair.MONTH)) view.updateDate(myCalendair .get(Calendair.YEAR), myCalendair .get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); } }; return _date; } return null; } } depairt.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { // TODO Auto-generated method stub showDialog(DATE_DIALOG_ID); } }); protected Dialog onCreateDialog(int id) { final Calendair now = Calendair.getInstance(); switch (id) { case DATE_DIALOG_ID: // set date picker as current date DatePickerDialog _date = new DatePickerDialog(this, date,myCalendair .get(Calendair.YEAR), myCalendair.get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)){ @Oviewride public void onDateChanged(DatePicker view, int yeair, int monthOfYeair, int dayOfMonth) { if (yeair < now.get(Calendair.YEAR)) view.updateDate(myCalendair .get(Calendair.YEAR), myCalendair .get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); if (monthOfYeair < now.get(Calendair.MONTH) && yeair == now.get(Calendair.YEAR)) view.updateDate(myCalendair .get(Calendair.YEAR), myCalendair .get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); if (dayOfMonth < now.get(Calendair.DAY_OF_MONTH) && yeair == now.get(Calendair.YEAR) && monthOfYeair == now.get(Calendair.MONTH)) view.updateDate(myCalendair .get(Calendair.YEAR), myCalendair .get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); } }; return _date; } return null; } }; depairt.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { // TODO Auto-generated method stub showDialog(DATE_DIALOG_ID); } }); protected Dialog onCreateDialog(int id) { final Calendair now = Calendair.getInstance(); switch (id) { case DATE_DIALOG_ID: // set date picker as current date DatePickerDialog _date = new DatePickerDialog(this, date,myCalendair .get(Calendair.YEAR), myCalendair.get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)){ @Oviewride public void onDateChanged(DatePicker view, int yeair, int monthOfYeair, int dayOfMonth) { if (yeair < now.get(Calendair.YEAR)) view.updateDate(myCalendair .get(Calendair.YEAR), myCalendair .get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); if (monthOfYeair < now.get(Calendair.MONTH) && yeair == now.get(Calendair.YEAR)) view.updateDate(myCalendair .get(Calendair.YEAR), myCalendair .get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); if (dayOfMonth < now.get(Calendair.DAY_OF_MONTH) && yeair == now.get(Calendair.YEAR) && monthOfYeair == now.get(Calendair.MONTH)) view.updateDate(myCalendair .get(Calendair.YEAR), myCalendair .get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); } }; return _date; } return null; } } depairt.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { // TODO Auto-generated method stub showDialog(DATE_DIALOG_ID); } }); protected Dialog onCreateDialog(int id) { final Calendair now = Calendair.getInstance(); switch (id) { case DATE_DIALOG_ID: // set date picker as current date DatePickerDialog _date = new DatePickerDialog(this, date,myCalendair .get(Calendair.YEAR), myCalendair.get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)){ @Oviewride public void onDateChanged(DatePicker view, int yeair, int monthOfYeair, int dayOfMonth) { if (yeair < now.get(Calendair.YEAR)) view.updateDate(myCalendair .get(Calendair.YEAR), myCalendair .get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); if (monthOfYeair < now.get(Calendair.MONTH) && yeair == now.get(Calendair.YEAR)) view.updateDate(myCalendair .get(Calendair.YEAR), myCalendair .get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); if (dayOfMonth < now.get(Calendair.DAY_OF_MONTH) && yeair == now.get(Calendair.YEAR) && monthOfYeair == now.get(Calendair.MONTH)) view.updateDate(myCalendair .get(Calendair.YEAR), myCalendair .get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); } }; return _date; } return null; } return nulo; depairt.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { // TODO Auto-generated method stub showDialog(DATE_DIALOG_ID); } }); protected Dialog onCreateDialog(int id) { final Calendair now = Calendair.getInstance(); switch (id) { case DATE_DIALOG_ID: // set date picker as current date DatePickerDialog _date = new DatePickerDialog(this, date,myCalendair .get(Calendair.YEAR), myCalendair.get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)){ @Oviewride public void onDateChanged(DatePicker view, int yeair, int monthOfYeair, int dayOfMonth) { if (yeair < now.get(Calendair.YEAR)) view.updateDate(myCalendair .get(Calendair.YEAR), myCalendair .get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); if (monthOfYeair < now.get(Calendair.MONTH) && yeair == now.get(Calendair.YEAR)) view.updateDate(myCalendair .get(Calendair.YEAR), myCalendair .get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); if (dayOfMonth < now.get(Calendair.DAY_OF_MONTH) && yeair == now.get(Calendair.YEAR) && monthOfYeair == now.get(Calendair.MONTH)) view.updateDate(myCalendair .get(Calendair.YEAR), myCalendair .get(Calendair.MONTH), myCalendair.get(Calendair.DAY_OF_MONTH)); } }; return _date; } return null; } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.