这就是我想要做的事情。一切正常,直到我尝试给第二个警报对话框充气,应用程序崩溃了。所以我想我不应该这样做。
那我该怎么做?
请参阅我的代码:
public void saveFingering() { //THIS IS WHAT'S BEING EXECUTED IF THE USER TABS SAVE ON THE FIRST ALERT DIALOG)
...
if (isFileNew == true) {
myDB.insertData(mapName, bStateStr, pitchStateStr, nodeHeight, nodeNote);
} else
{
showSaveConfirmDialog(mapName); //THIS IS FOR THE 2ND ALERT DIALOG
...
}
}
public void showSaveConfirmDialog(String mapName) {
DialogFragment confirmDialogue = new ConfirmSavingDialogueFragment();
confirmDialogue.show(getSupportFragmentManager(), "ConfirmSavingDialogueFragment");
}
public class ConfirmSavingDialogueFragment extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
saveConfirmDialogueView = inflater.inflate(R.layout.dialog_save_confirm, null); //CRUSH HERE
...
}
}
答案 0 :(得分:0)
您的第一个对话框也是DialogFragment
吗?在第二个对话框膨胀之前,第一个对话框是否被解除?