Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
DialogFragment中的Show()方法在android中不起作用_Android_Dialog_Show_Dialogfragment - Fatal编程技术网

DialogFragment中的Show()方法在android中不起作用

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

我正在从DialogFragment内部调用DialogFragment。此类中的Show()方法仅在特定情况下工作。代码如下:

//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();