How to remove row in ListView using a SimpleCursorAdapter
<p>I have three different activities sharing exactly the same layout (a ListView and a TextView). The ListView uses this layout for its SimpleCursorAdapter:</p>

<pre><code>  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:paddingBottom="2dp"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"&gt;

    &lt;TextView
      android:id="@+id/locationName"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="left"
      android:text="Länsnamn"
      android:textAppearance="?android:attr/textAppearanceMedium"&gt;
    &lt;/TextView&gt;

    &lt;LinearLayout
      android:id="@+id/num_stores_row"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:orientation="horizontal"&gt;

      &lt;TextView
        android:id="@+id/numStores_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="left"
        android:textSize="10dp"
        android:text="Antal butiker: "&gt;
      &lt;/TextView&gt;

      &lt;TextView
        android:id="@+id/numStores"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="10dp"
        android:text="0"&gt;
      &lt;/TextView&gt;
    &lt;/LinearLayout&gt;

    &lt;LinearLayout
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:orientation="horizontal"&gt;

      &lt;TextView
        android:id="@+id/numItems_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="left"
        android:textSize="10dp"
        android:text="Antal artiklar: "&gt;
      &lt;/TextView&gt;

      &lt;TextView
        android:id="@+id/numItems"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="10dp"
        android:text="0"&gt;
      &lt;/TextView&gt;
    &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
</code></pre>

<p>The program goes from activity #1, user picks an item in the list, activity #2 starts, user picks list, activity #3 starts.</p>

<p>Now, all the list items turn up fine just like they should, but for activity #3 I'd like to remove the entire row with id num_stores_row, and I seem to have a hard time doing this. I cannot do this in the setViewBinder since the row is not targeted by the adapter, and I cannot do it outside since the ListView is not activated until the data arrives. I've tried findViewById(R.id.num_stores_row).setVisibility(View.GONE); here and there, but the simulator crashes every time.</p>

<p>How do I remove it?</p>
