StackOverflowError when trying to inflate a custom layout for an AlertDialog inside a DialogFragment
If found the problem. DialogFragment.getLayoutInflater() contains a call to onCreateDialog()
, so calling onCreateDialog()
from within getLayoutInflater()
creates an infinite loop.
I found the solution in this answer: https://stackoverflow.com/a/10585164/2020340
I'm not exactly sure if this is good form, because it doesn't really seem like it, but I replaced
getLayoutInflater(savedInstanceState)
with
getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
Edit: They are the same. See this answer for details: https://stackoverflow.com/a/20995083/2020340