Calling DialogFragment from Fragment

谁都会走 提交于 2019-12-05 07:40:44
Raghunandan

You do not have a static method by the name newInstance. Add the below in your Dialog Fragment

public static MyDialogFragment newInstance() {
    MyDialogFragment f = new MyDialogFragment();
    return f;
    }

You can find more info and an example in the docs

http://developer.android.com/reference/android/app/DialogFragment.html

And you can also call MyDialogFragment without newInstance method like

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