0
我使用此方法showDatePickerDialog(this.getCurrentFocus());
加載對話框。這很好。但是當我在setOnClickListener
裏面顯示按鈕單擊對話框時,出現編譯器錯誤。錯誤是The method getCurrentFocus() is undefined for the type new View.OnClickListener(){}
。我的代碼遵循showDatePickerDialog無法加載DatePicker對話框
frombutton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
showDatePickerDialog(this.getCurrentFocus());
}
});
盧卡斯克努特是正確的,應使用活動情境。 – Raghunandan