0
我正嘗試使用項目選項創建AlertDialog。我使用下面的代碼在Android中的AlertDialog中顯示項目時出現異常
final CharSequence[] items={"One","two","three"};
alertDialog = new AlertDialog.Builder(this).create();
alertDialog.setTitle("Choose COlor");
alertDialog.setItems(items, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// The 'which' argument contains the index position
// of the selected item
}
});
但我一直得到錯誤的編譯
的方法setItems(CharSequence的[],新 DialogInterface.OnClickListener(){})是不確定的鍵入 AlertDialog
我很困惑,因爲我看到使用該代碼的所有例子,那麼爲什麼這個錯誤?
謝謝..你救了我的日子:-) – user669231 2013-02-23 04:11:40