동적 데이터가있는 버튼을 누르면 대화 상자가 나타나지만 같은 버튼을 다시 누르면 같은 데이터가 나타납니다. 다음 질문이 아닌 이유를 알아 내기 위해 로그를 사용했습니다. 다음은 대화의 때마다 사용자 버튼을 눌러 데이터를 업데이트하는 코드Android 대화 상자 문제
protected Dialog onCreateDialog(int id)
{ AlertDialog.Builder dilog = new AlertDialog.Builder(this);
switch (id)
{
case 99:
String qa = showNext(); //gets question from database new question every time
dilog.setTitle("Team A player" + contactList.get(1).getName());
dilog.setMessage(qa);
dilog.setNegativeButton("ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id)
{
dialog.cancel();
}
});
break;
}
return dilog.create();
}