title: Checkbox value is true but tick is not showing - Android / Java
body: <p>Basically here I have three(3) checkbox list in three(3) different fragment. When I open the activity, my checkbox in the default fragment display like normal, but the one in different fragment display differently. The value of the checkbox is still true. Below is the image for the checkbox to make things clearer and also my code.</p>
  
  <p>First fragment page:</p>
  
  <p><a href="https://i.stack.imgur.com/e798I.png" rel="noreferrer"><img src="https://i.stack.imgur.com/e798I.png" alt="enter image description here"></a></p>
  
  <p>Second fragment page:</p>
  
  <p><a href="https://i.stack.imgur.com/Kjyrn.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Kjyrn.png" alt="enter image description here"></a></p>
  
  <p>Code for setting up the checkbox and its <code>if condition</code></p>
  
  <pre><code>private void setCheckBox(ArrayList&lt;DataPrefType&gt; arrayList){
      for(int i = 0; i &lt; arrayList.size(); i++){
          id = i + 1;
          checkBox = new CheckBox(getActivity());
          checkBox.setId(i + 1);
          checkBox.setText(arrayList.get(i).getName());
          checkBox.setPadding(10, 10, 10, 10);
          checkBox.setLayoutParams(params);
          checkBox.setGravity(Gravity.CENTER);
          checkBoxLayout.addView(checkBox);
  
          if(!userPreference.isEmpty() || userPreference != null){
              for(int j = 0; j &lt; userPreference.get(0).getDataPrefTypeArrayList().size(); j++){
                  int retrieveId = Integer.parseInt(userPreference.get(0).getDataPrefTypeArrayList().get(j).getId());
                  if(checkBox.getId() == retrieveId)
                      checkBox.setChecked(true);
              }
          }
  </code></pre>