Show dialog from fragment?

前端 未结 7 804
再見小時候
再見小時候 2020-11-30 19:17

I have some fragments that need to show a regular dialog. On these dialogs the user can choose a yes/no answer, and then the fragment should behave accordingly.

Now,

7条回答
  •  攒了一身酷
    2020-11-30 20:04

        public static void OpenDialog (Activity activity, DialogFragment fragment){
    
        final FragmentManager fm = ((FragmentActivity)activity).getSupportFragmentManager();
    
        fragment.show(fm, "tag");
    }
    

提交回复
热议问题