@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
et=(EditText)rootView.findViewById(R.id.et1);
String str=et.getText().toString();
Fragment frag=new Fragment();
Bundle bundle1=new Bundle();
bundle1.putString("name", str);
frag.setArguments(bundle1);
getFragmentManager().beginTransaction().add(R.id.container_body, frag).commit();
return inflater.inflate(R.layout.fragment_currentmovie, container, false);
}
它顯示rootView不能得到解決,我需要編輯文本等添加到字符串str因此使用捆綁我可以將它傳遞到下一個片段
做得一樣'查看rootView = inflater.inflate(R.layout.fragment_currentmovie,容器,FALSE);',也返回''從onCreateView' –
rootView rootView'應該是您正在膨脹的人;返回最後一行 –
我需要替換返回inflater.inflate(R.layout.fragment_currentmovie,容器,false);與迴歸rootview – user3409897