一旦用户开始更改它,我希望能够检测到日期选择器上的更改。但是,我不想使用 datrpickerdialog。有谁知道为什么当我更改 datepicker 上的日期时 onDateSet(DatePicker arg0, int arg1, int arg2, int arg3) 不会触发?
我非常感谢您对此发表任何评论。干杯
这是我的代码的简化版本:
public class AddItem extends Activity implements OnDateChangedListener,OnDateSetListener{
DatePicker start ;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.entryelements);
start = (DatePicker) findViewById(R.id.start);
@Override
public void onDateChanged(DatePicker view, int year, int monthOfYear,
int dayOfMonth) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(),
" thiv view"+year,
Toast.LENGTH_LONG).show();
Log.v("indatechange", "ok");
}
@Override
public void onDateSet(DatePicker arg0, int arg1, int arg2, int arg3) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(),
" thiv view"+arg0,
Toast.LENGTH_LONG).show();
Log.v("indatechange", "ok");
}
}