DatePickerDialog
package com.pingyijinren.helloworld.activity; import android.app.DatePickerDialog; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.DatePicker; import android.widget.Toast; import com.pingyijinren.helloworld.R; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private AlertDialog alertDialog; private Button button; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button=(Button)findViewById(R.id.button); button.setOnClickListener(this); } @Override public void onClick(View v) { DatePickerDialog datePickerDialog=new DatePickerDialog(this,new DatePickerDialog.OnDateSetListener(){ @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { monthOfYear++; Toast.makeText(MainActivity.this,year+"/"+monthOfYear+"/"+dayOfMonth,Toast.LENGTH_SHORT).show(); } },2016,5,2); datePickerDialog.show(); } }