라디오 그룹으로 두 개의 라디오 버튼과 "실행"버튼이 있습니다. 라디오 버튼을 선택하고 "실행"을 누르고 라디오 선택에 따라 대체 대화 상자를 보냅니다. 나는에 오류가 마지막에서 두 번째 라인 (경고 대화 상자 빌더를 생성) 다음왜이 변수를 "해결할 수 없습니까?"
이private OnClickListener myClickcalcHandler = new OnClickListener() {
public void myClickcalcHandler(View view) {
switch (view.getId()) {
case R.id.calcbutton:
RadioButton insideButton = (RadioButton) findViewById(R.id.radioButton1);
RadioButton outsideButton = (RadioButton) findViewById(R.id.radioButton1);
}
if
(outsideButton.isChecked()){
//do what you want
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
context);
// set title
alertDialogBuilder.setTitle("some outside activity");
button = (Button) findViewById(R.id.emailbutton);
// set dialog message
alertDialogBuilder
.setMessage(R.string.email_long)
.setCancelable(false)
.setNegativeButton("Close",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
// if this button is clicked, just close
// the dialog box and do nothing
dialog.cancel();
}
});
}
else if
(insideButton.isChecked()){
//do what you want
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
context);
// set title
alertDialogBuilder.setTitle("some inside activity");
button = (Button) findViewById(R.id.emailbutton);
// set dialog message
alertDialogBuilder
.setMessage(R.string.email_long)
.setCancelable(false)
.setNegativeButton("Close",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
// if this button is clicked, just close
// the dialog box and do nothing
dialog.cancel();
}
});
}
// create alert dialog
AlertDialog alertDialog = alertDialogBuilder.create();
// show it
alertDialog.show();
}
그래서 일식 편집기는 그냥 "alertDialogBuilder가 해결 될 수 없다"라고, 나는 이유를 알고하지 않습니다 .
private OnClickListener myClickcalcHandler = new OnClickListener() {
public void myClickcalcHandler(View view) {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
context);
switch (view.getId()) {
case R.id.calcbutton:
RadioButton insideButton = (RadioButton) findViewById(R.id.radioButton1);
RadioButton outsideButton = (RadioButton) findViewById(R.id.radioButton1);
}
//YOUR CODE HERE.....
로 - 프롬프트 응답에 대한 감사 - 나는 // 여전히 이러한 모든하고 "해결 될 수없는"수를 시도했다 경고 대화 상자 만들기 \t \t \t AlertDialog alertDialog = alertDialogBuilder.create(); - 복사 된 섹션 위의 스크립트에서 alertDialogBuilder를 사용했다는 것이 중요한지 확실하지 않지만 여러 번 사용할 수 있다고 가정합니다. –