Refresh ListView after changing listItem
<p>I am new to programming/Android and I am trying to refresh a ListView after editing the listItem from a DialogFragment window. Here is where the ListView is defined:</p>

<pre><code>public class AnswersList extends AppCompatActivity {

private ListView mListAnswer;
private AnswerAdapter mAnswerAdapter;
private static final String ANSWERS_TO_LISTVIEW = "answers_to_listview";
private static final String TAG = "AnswersList";

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.list_answers);

    mAnswerAdapter = new AnswerAdapter();

    mListAnswer = (ListView) findViewById(R.id.listView);

    mListAnswer.setAdapter(mAnswerAdapter);

    // handle clicks on listview
    mListAnswer.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView&lt;?&gt; adapter, View view, int whichItem, long id) {

            Question tempQuestion = mAnswerAdapter.getItem(whichItem);

            // create a new dialog window
            DialogShowAnswer dialog = new DialogShowAnswer();
            // send in a reference to the Note to be shown
            dialog.sendQuestionSelected(tempQuestion);

            // Show the dialog window with the note in it
            dialog.show(getSupportFragmentManager(), "");

        }
    });


}

public class AnswerAdapter extends BaseAdapter {

    ArrayList&lt;Question&gt; mListAnswers = new ArrayList&lt;Question&gt;();
    QuestionBank mQuestionBank;
    Context mContext = getApplicationContext();

    public AnswerAdapter() {
        mQuestionBank = QuestionBank.get(mContext);
        mListAnswers = mQuestionBank.getAnswers();
    }

    public ArrayList&lt;Question&gt; getListAnswers () {
        return mListAnswers;
    }

    @Override
    public int getCount() {
        return mListAnswers.size();
    }

    @Override
    public Question getItem(int position) {
        return mListAnswers.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        ** A bunch of code here **

        return convertView;
    }

    public void updateList() {
        mListAnswers = mQuestionBank.getAnswers();
        notifyDataSetChanged();
    }


}


}
</code></pre>

<p>Here is the code for the dialog window:</p>

<pre><code>public class DialogShowAnswer extends DialogFragment {

private Question mQuestion;
private static final String KEY_INDEX = "index";
private static final String TAG = "DialogShowAnswer";

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    if(savedInstanceState != null) {
        mQuestion = savedInstanceState.getParcelable(KEY_INDEX);
    }

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    LayoutInflater inflater = getActivity().getLayoutInflater();
    final View dialogView = inflater.inflate(R.layout.dialog_show_answer, null);

    TextView questionText = (TextView) dialogView.findViewById(R.id.questionAnswerDialog);
    TextView answerText = (TextView) dialogView.findViewById(R.id.answerAnswerDialog);
    TextView dateText = (TextView) dialogView.findViewById(R.id.dateAnswerDialog);
    final Button btnClose = (Button) dialogView.findViewById(R.id.btnClose);
    final Button btnSave = (Button) dialogView.findViewById(R.id.btnSave);
    ImageView editIcon = (ImageView) dialogView.findViewById(R.id.editIcon);

    btnSave.setVisibility(View.GONE);
    questionText.setText(mQuestion.getQuestion());
    answerText.setText(mQuestion.getAnswer());
    dateText.setText(mQuestion.getDateString());

    builder.setView(dialogView);

    editIcon.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            ViewSwitcher switcher = (ViewSwitcher) dialogView.findViewById(R.id.viewSwitcher);
            final EditText editAnswer = (EditText) switcher.findViewById(R.id.editAnswerDialog);

            if(btnSave.getVisibility() == View.GONE) {
                btnSave.setVisibility(View.VISIBLE);
            } else {
                btnSave.setVisibility(View.GONE);
            }
            switcher.showNext(); //or switcher.showPrevious();
            editAnswer.setText(mQuestion.getAnswer());

            btnSave.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                    String answer = editAnswer.getText().toString();

                    if (answer.length() &gt; 0) {

                        mQuestion.setAnswerDate();
                        mQuestion.setAnswer(answer);

                        QuestionBank questionBank = QuestionBank.get(getContext());

                        questionBank.updateQuestion(mQuestion.getId(), mQuestion);

                        AnswersList callingActivity = (AnswersList) getActivity();
                        callingActivity.getAdapter.updateList();

                        Log.d(TAG, "notifyDataSetChanged() called");

                        dismiss();
                    } else {
                        Toast.makeText(getContext(), R.string.empty_answer_field, Toast.LENGTH_SHORT).show();
                    }


                }
            });

        }
    });

    btnClose.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dismiss();
        }
    });



    return builder.create();
}

public void sendQuestionSelected(Question question) {
    mQuestion = question;
}

@Override
public void onSaveInstanceState(Bundle savedInstanceState) {

    super.onSaveInstanceState(savedInstanceState);
    if(mQuestion != null)
        savedInstanceState.putParcelable(KEY_INDEX, mQuestion);
}


}
</code></pre>

<p>I've been stuck on this for days. All help appreciated!</p>