4

Android フラグメントがあります。ビューを作成するとき、レイアウトのフィールドにモデルの値を入力します。ある時点で、同じクラスモデルを使用してビューを再作成したいと思いますが、他の値を使用します。

 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 something like that but I don't know if that is ok, or is a more simple way to do that
}
4

0 に答える 0