title: How can i change the texts in my fragments each time? For a quiz app that needs the same fragment for each question
body: <p>So I am making a quiz app and for each question of course, the layout will look the same but questions and possible answers will be different. I have seen that using fragments in this case would be suitable and i tried learning it but its confusing. Can someone help me with the syntax etc how i can change the text of the questions, buttons when given a questions and a list of answers?</p>
  <pre><code>import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.Button;
  import android.widget.TextView;
  
  import androidx.annotation.NonNull;
  import androidx.annotation.Nullable;
  import androidx.fragment.app.Fragment;
  
  import java.util.ArrayList;
  
  public class QuestionFragment extends Fragment {
  
      Button btnOption1, btnOption2, btnOption3, btnOption4;
      Button btnSubmit;
      TextView txtQuestion;
  
      @Nullable
      @Override
      public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
  
          View questionFragmentView = inflater.inflate(R.layout.question_fragment, container, false);
  
          btnOption1 = questionFragmentView.findViewById(R.id.btnOption1);
          btnOption2 = questionFragmentView.findViewById(R.id.btnOption2);
          btnOption3 = questionFragmentView.findViewById(R.id.btnOption3);
          btnOption4 = questionFragmentView.findViewById(R.id.btnOption4);
          btnSubmit = questionFragmentView.findViewById(R.id.btnSubmit);
          txtQuestion = questionFragmentView.findViewById(R.id.txtQuestion);
  
          return questionFragmentView;
      }
  }
  </code></pre>
  <p>this is the Fragment which i have created.</p>
  <p><a href="https://i.stack.imgur.com/hMVmQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hMVmQ.png" alt="and the fragment looks like this:" /></a></p>
  <p>How can I change the Question and button texts each time for a new question?</p>
  <p>Thank you very much!</p>