程序员人生 网站导航

【android】时间选择器

栏目:综合技术时间:2015-04-21 08:58:05
OnDateSetListener listener = new OnDateSetListener() { @Override public void onDateSet(DatePicker arg0, int arg1, int arg2, int arg3) { // TODO Auto-generated method stub String str = null; String str1 = null; if (arg2 < 10) { arg2 = arg2 + 1; str = "0" + arg2; } else { str = arg2 + ""; } if (arg3 < 10) { str1 = "0" + arg3; } else { str1 = arg3 + ""; } t4.setText(arg1 + "-" + str + "-" + str1); } }; case R.id.textView4: Calendar c1 = Calendar.getInstance(); int year = c1.get(Calendar.YEAR); int monthOfYear = c1.get(Calendar.MONTH); int dayOfMonth = c1.get(Calendar.DAY_OF_MONTH); DatePickerDialog dialog = new DatePickerDialog(ToRecordActivit.this, listener, year, monthOfYear, dayOfMonth); dialog.show(); break;



制止转载

------分隔线----------------------------
------分隔线----------------------------

最新技术推荐