我试图从editText输入日期值,但我一直在犯错,我应该怎么做?
EditText DataI = (EditText) findViewById(R.id.DataI);
EditText DataF = (EditText) findViewById(R.id.DataF);
calendar1.setTime(DataI);
calendar2.setTime(DataF);
答案 0 :(得分:0)
使用:
SimpleDateFormat format=new SimpleDateFormat("dd/MM/yyyy");
calendar1.setTime(format.parse(DataI.getText().toString());
calendar2.setTime(format.parse(DataF.getText().toString());
答案 1 :(得分:0)