Is it possible to launch a DialogFragment from a Preference in a PreferenceActivity?

廉价感情. 提交于 2019-12-09 02:49:47

问题


I am converting my app to use the v4 compatibility package and fragments. I have done well so far, but I need to launch a DialogFragment from a preference click in a PreferenceActivity. Since there isn't a PreferenceFragment in the compatibility library, I'm stuck with using PreferenceActivity. Is it possible to get a reference to the fragment manager and call the DialogFragment or do I just have to continue using the old dialog if I need a dialog from a preference?


回答1:


Not without jumping through hoops.

You could make a very simple activity with the sole purpose of launching the DialogFragment. If you do this you will need to finish() that activity when the DialogFragment dialog has been dismissed.



来源:https://stackoverflow.com/questions/7922906/is-it-possible-to-launch-a-dialogfragment-from-a-preference-in-a-preferenceactiv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!