DialogFragment在setView时报 java.lang.StackOverflowError错

自己的Fragment继承DialogFragment,在onCreateDialog中设置AlertDialog,当用

AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setView(getLayoutInflater(savedInstanceState).inflate(R.layout.my_dialog,null));

来取得自己定义好的layout时,会报 java.lang.StackOverflowError错。用下面的方法就没有问题:

builder.setView(((LayoutInflater)getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.my_dialog, null))
posted @ 2013-06-25 14:39  shtzsp  阅读(312)  评论(0编辑  收藏  举报