title: Set invisible Check Box to visible in list view
body: <p>I have an invisible checkbox in a ListView, which I want to make visible. But, not able to achieve it. Have a look at the following code snippets:</p>
  
  <p><strong>List activity :-</strong></p>
  
  <pre><code>public class SelectDateRangeActivity extends AppCompatActivity {
  
      ListView mOptionsList;
      LogRangeOptionsAdapter mAdapter;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_select_date_range);
  
          mOptionsList = (ListView) findViewById(R.id.date_range_options_list);
          mAdapter = new LogRangeOptionsAdapter(this, R.layout.date_range_option_list_item, getResources().getStringArray(R.array.image_log_date_filter_options));
          mOptionsList.setAdapter(mAdapter);
      }
  
      @Override
      public void onResume() {
          super.onResume();
  
          Bundle extras = getIntent().getExtras();
          if (extras != null) {
              String selectedOption = extras.getString(Utility.EXTRA_LOG_SELECTED_DATE_RANGE);
              if (selectedOption.equalsIgnoreCase(getResources().getStringArray(R.array.image_log_date_filter_options)[0])){
                  final View view = mOptionsList.getAdapter().getView(0, null, mOptionsList);
                  CheckBox c = (CheckBox) view.findViewById(R.id.image_log_checkbox);
                  c.setVisibility(View.VISIBLE);
                  c.setChecked(true);
                  mAdapter.notifyDataSetChanged();
              }
  
              if (selectedOption.equalsIgnoreCase(getResources().getStringArray(R.array.image_log_date_filter_options)[1])){
                  final View view = mOptionsList.getAdapter().getView(1, null, mOptionsList);
                  CheckBox c = (CheckBox) view.findViewById(R.id.image_log_checkbox);
                  c.setVisibility(View.VISIBLE);
                  c.setChecked(true);
                  mAdapter.notifyDataSetChanged();
              }
  
              if (selectedOption.equalsIgnoreCase(getResources().getStringArray(R.array.image_log_date_filter_options)[2])){
                  final View view = mOptionsList.getAdapter().getView(0, null, mOptionsList);
                  CheckBox c = (CheckBox) view.findViewById(R.id.image_log_checkbox);
                  c.setVisibility(View.VISIBLE);
                  c.setChecked(true);
                  mAdapter.notifyDataSetChanged();
              }
  
              if (selectedOption.equalsIgnoreCase(getResources().getStringArray(R.array.image_log_date_filter_options)[3])){
                  final View view = mOptionsList.getAdapter().getView(0, null, mOptionsList);
                  CheckBox c = (CheckBox) view.findViewById(R.id.image_log_checkbox);
                  c.setVisibility(View.VISIBLE);
                  c.setChecked(true);
                  mAdapter.notifyDataSetChanged();
              }
          }
      }
  }
  </code></pre>
  
  <p><strong>Adapter:-</strong></p>
  
  <pre><code>public class LogRangeOptionsAdapter extends ArrayAdapter&lt;String&gt; {
  
      Context mAdapterContext;
      String[] mItems;
  
      public LogRangeOptionsAdapter(Context context, int resource, String[] objects) {
          super(context, resource, objects);
          this.mAdapterContext = context;
          this.mItems = objects;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          if (convertView == null) {
              LayoutInflater inflater = (LayoutInflater) mAdapterContext.getSystemService(mAdapterContext.LAYOUT_INFLATER_SERVICE);
              convertView = inflater.inflate(R.layout.date_range_option_list_item, parent, false);
          }
  
          TextView mTitleText = (TextView) convertView.findViewById(R.id.date_range_option_text);
          mTitleText.setText(mItems[position]);
          final String titleText = mTitleText.getText().toString();
  
          convertView.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Intent returnOptionIntent = new Intent(mAdapterContext, ImageLogActivity.class);
                  returnOptionIntent.putExtra(Utility.EXTRA_LOG_DATE_RANGE_OPTION, titleText);
                  Activity activity = (Activity) mAdapterContext;
                  activity.setResult(Utility.INTENT_IMAGE_LOG_OPTIONS_CODE, returnOptionIntent);
                  activity.finish();
                  activity.overridePendingTransition(R.anim.anim_slide_in_left, R.anim.anim_slide_out_left);
              }
          });
  
          return convertView;
      }
  }
  </code></pre>
  
  <p><strong>Select date range xml:-</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      tools:context="com.sigue.sigueagent.SelectDateRangeActivity"&gt;
  
      &lt;ListView
          android:id="@+id/date_range_options_list"
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
      &lt;/ListView&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><strong>Date Range options:-</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="horizontal"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingTop="@dimen/item_date_range_padding_top"
      android:paddingBottom="@dimen/item_date_range_padding_bottom"&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="New Text"
          android:id="@+id/date_range_option_text"
          android:layout_alignBottom="@+id/image_log_checkbox"
          android:layout_alignTop="@+id/image_log_checkbox"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:gravity="center" /&gt;
  
      &lt;CheckBox
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/image_log_checkbox"
          android:layout_alignParentTop="true"
          android:layout_alignParentRight="true"
          android:layout_alignParentEnd="true"
          android:visibility="invisible"/&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>