4

I have an Android fragment. When I'm creating view I fill fields from layout with values from an model. and at one point I want to recreate view using the same class model but with other values.

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

I have a private function which will call at on click on view

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
}
Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Mosu
  • 61
  • 8

0 Answers0