DialogFragment中的Show()方法在android中不起作用
我正在从DialogFragment内部调用DialogFragment。此类中的Show()方法仅在特定情况下工作。代码如下:DialogFragment中的Show()方法在android中不起作用,android,dialog,show,dialogfragment,Android,Dialog,Show,Dialogfragment,我正在从DialogFragment内部调用DialogFragment。此类中的Show()方法仅在特定情况下工作。代码如下: //Not Working DialogBoxFragment dialog = new DialogBoxFragment(); Bundle args = new Bundle(); args.putString("selectedLine", "test"); dialog.setArguments(args); android.app.Fragmen
//Not Working
DialogBoxFragment dialog = new DialogBoxFragment();
Bundle args = new Bundle();
args.putString("selectedLine", "test");
dialog.setArguments(args);
android.app.FragmentManager fm = getActivity().getFragmentManager();
dialog.show(fm,"Dialog");
如果我对某些行进行注释,则它会起作用:
DialogBoxFragment dialog = new DialogBoxFragment();
// Bundle args = new Bundle();
// args.putString("selectedLine", "test");
// dialog.setArguments(args);
android.app.FragmentManager fm = getActivity().getFragmentManager();
dialog.show(fm,"Dialog");
在DialogFragmentManager类中,我们有:
私有void DeletePhoneNumber(){
}
有人能解释一下原因吗
事先非常感谢。
莱昂纳多我已经解决了这个问题。
问题是方法putString(),我发送了错误的参数,但没有发出错误消息
谢谢你帮助我。
莱昂纳多你能发布与
DialogBoxFragment
使用selectedLine
参数所做操作相关的代码吗?DialogBoxFragment中的onCreateDialog调用了吗?带有注释行的代码是的,但是如果我在Show()方法之前放置任何代码,它似乎没有被调用。
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity());
alertDialogBuilder.setTitle("SmartCall");
alertDialogBuilder.setMessage(**getArguments().getString("selectedLine")**);
alertDialog = alertDialogBuilder.create();
alertDialog.show();