我有一个安卓片段 当我创建视图时,我使用模型中的值从布局填充字段。 在某一点上,我想使用相同的类模型重新创建视图,但使用其他值。
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater
.inflate(R.layout.item_view, container, false);
editText = (EditText) v.findViewById(R.id.question_text);
questionText.setText(myModel.getName());
---------------
}
我有一个私人功能,将点击视图
private void recreateView(MyModel model){
myModel = model;
//here i want to recall onCreateView or somthing like that but i don't know if that is ok, or is a more simple way to do that
}