我有一个EditText,我为其设置了onClickListener并打开了材料Calendar。问题是当我在模拟器中运行应用程序时它工作但是当我在移动设备上运行时它停止点击编辑文本并显示错误 无法向调试器发送回复:Broken pipe + android
from_date.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view)
{
Calendar c = Calendar.getInstance();
int Year = c.get(Calendar.YEAR);
int Month = c.get(Calendar.MONTH);
int Day = c.get(Calendar.DAY_OF_MONTH);
flage_from=true;
flage_to=false;
datePickerDialog = DatePickerDialog.newInstance(MainActivity.this, Year, Month, Day);
datePickerDialog.setThemeDark(false);
datePickerDialog.showYearPickerFirst(false);
datePickerDialog.setAccentColor(Color.parseColor("#215f8b"));
// datePickerDialog.setTitle("Select Date");
datePickerDialog.show(getFragmentManager(), "DatePickerDialog");
}
});
@覆盖 public void onDateSet(DatePickerDialog view,int Year,int Month,int Day) {
String date = Day + "/" + Month + "/" + Year;
if(flage_from){
from_date.setText(date);
}else {
to_date.setText(date);
}
}