title: How to disable items in a List View?
body: <p>I have a list view which is populated via records from the database. 
  Now i have to make some records visible but unavailable for selection, 
  how can i achieve that?</p>
  
  <p>here's my code </p>
  
  <pre><code>public class SomeClass extends ListActivity { 
      private static List&lt;String&gt; products; 
      private DataHelper dh; 
      public void onCreate(Bundle savedInstanceState) { 
          dh = new DataHelper(this); 
          products = dh.GetMyProducts();  /* Returns a List&lt;String&gt;*/ 
          super.onCreate(savedInstanceState); 
          setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.myproducts, products)); 
          ListView lv = getListView();
          lv.setTextFilterEnabled(true); 
          lv.setOnItemClickListener( new OnItemClickListener() { 
              @Override 
              public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { 
                  // TODO Auto-generated method stub 
                  Toast.makeText(getApplicationContext(), ((TextView) arg1).getText(), Toast.LENGTH_SHORT).show(); 
              } 
          }); 
      } 
  }
  </code></pre>
  
  <p>The layout file myproducts.xml is as follows:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; 
  &lt;TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:padding="10dp" 
      android:textSize="16sp"&gt; 
  &lt;/TextView&gt;
  </code></pre>