Answer the question
In order to leave comments, you need to log in
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
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();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question