@Override public void deleteQuestion(long questionId) { Question q = questionQuery.get(questionId); ConfirmationDialog dialog = new ConfirmationDialog(); dialog.setOnPositivArgument(questionId); dialog.setQuestionText(q.getText()); dialog.show(getFragmentManager(), "ConfirmationDialog"); }
@Override public void onPositiveConfirmation(Object onPositivArgument) { if (onPositivArgument instanceof Long) { Long questionId = (Long) onPositivArgument; questionQuery.delete(questionId); answerQuery.deleteAllAnswersAsociated2Question(questionId); if (mTwoPane) { QuestionManagerListFragment listFragment = (QuestionManagerListFragment) getSupportFragmentManager().findFragmentById(R.id.question_list); QuestionManagerFragment managerFragment = (QuestionManagerFragment) getSupportFragmentManager().findFragmentById(R.id.question_detail_container); managerFragment.clearDialog(); listFragment.updateQuestionList(); } } }