클릭 가능한 레이아웃에 TextView가 포함 된 활동을하고 있습니다. onClick 메서드는 TextView의 가능한 값 (3 가지 가능한 값 (0), (1), (2))이 포함 된 경고 대화 상자를 엽니 다. 값을 가져 오려면 AlertDialog를 사용해야하며 Spinner는 작동하지 않습니다. int BUSselection은 프로그램 시작시 -1로 선언됩니다.TextView setText AlertDialog가 늦음
public void showStartingDialog(){
DialogFragment dialog = new StartingDialogFragment();
dialog.show(getFragmentManager(), "StartingDialogFragment");
}
public void onBUSDialogSelect(DialogFragment dialog, int which)
{BUSselection = which;}
public void changeStarting(View v) //OnClick method
{
showStartingDialog();
TextView basic = (TextView)findViewById(R.id.startingBox);
if(BUSselection==0)
{
basic.setText("0");
}
else if (BUSselection ==1)
{
basic.setText("1");
}
else if (BUSselection ==2)
{
basic.setText("2");
}
else
{
}
}
기본적으로이 프로그램은 (위치 2에서, 위치 1에서 위치 0 "0", "2", "1")을에 AlertDialog리스트의 선택 옵션을 가지고에 그 값을 넣어하도록되어 TextView. 그러나, 내 문제는 내가 위치 1을 선택하면, 내가 (경고 대화 상자가 다시 나타납니다) 두 번째 시간을 클릭하기 전까지는 TextView에 1이 나타나지 않는다는 것입니다. 내가 도대체 뭘 잘못하고있는 겁니까?