S
S
Sasha Brahms2016-07-05 07:37:08
Android
Sasha Brahms, 2016-07-05 07:37:08

Is there onPrepareDialog in FragmentDialog?

Hi all.
I am learning a lesson with preparing a dialog box, but the lesson is old and is not built using DialogFragment, the lesson uses the onPrepareDialog method to prepare the dialog display.
Can you please tell me how to implement this if I build a dialog inheriting the DialogFragment class?
mb Fragment.onResume()?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
itdroid, 2016-07-05
@itdroid

Using DialogFragment is the correct solution. Derivate from DialogFragment and override method
and create a dialog like in the onPrepareDialog method.
For example:

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    builder.setTitle(title);
    builder.setMessage(msg);

    return builder.create();
}

R
Rou1997, 2016-07-05
@Rou1997

Learn not the old lesson, or abandon the DialogFragment.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question