title: How to check if ListView item is checked or not
body: <p>I am using <code>list.setItemChecked(position, true)</code> to set items as checked in my <code>ListView</code>, when clicked. I have found no way however, of seeing if the list item is Checked or not.</p>
  
  <p>The <code>ListView</code> item does not have a checkbox/radio and does not use <code>CheckedTextView</code>. The <code>ListView</code> is set to <code>CHOICE_MODE_SINGLE</code>.</p>
  
  <p><strong>ListView onItemClick Listener</strong></p>
  
  <pre><code>@Override
  public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int position, long l) {
        list.setItemChecked(position, true);
  }
  </code></pre>
  
  <p><strong>Adapter getView</strong></p>
  
  <pre><code>@Override
  public View getView(int position, View convertView, ViewGroup parent) {
      inflater = (LayoutInflater) context
          .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      rowView = inflater.inflate(R.layout.rowlayout, parent, false);
      vg = parent;
      TextView textView = (TextView) rowView.findViewById(R.id.label);
      textView.setText(names[position]);
      TextView textView2 = (TextView) rowView.findViewById(R.id.tvValue);
      textView2.setText(stock[position]);
      return rowView;
  }
  </code></pre>
  
  <p>Is there a way to check if the list item is checked or not? For example, in the onItemClick listener doing something like:</p>
  
  <pre><code>if(position.isChecked()) {
      //do something
  }
  </code></pre>
  
  <p>I have looked all over and cannot seem to come up with anything without adding a checkbox/radio to the layout and changing things around. I appreciate any advice, thanks!</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>The title was a little confusing, so just to clarify: The problem isn't that the item isn't clearly selected/unselected, it's that I need to handle the second click on an item that is selected. I was using simple if/else logic to handle this, which worked but causes issues elsewhere in the project, which is why I am wondering if there is some built-in functionality for checking if an item is checked or not.</p>