title: ListView in TabHost scroll/click problems
body: <p>I have a strange problem that recently appeared. At first I was loading all items in my ListView. It was scrolling all fine. Items were clickable and all was working fine. </p>
  
  <p>Then in the getView of my adapter I added that: </p>
  
  <pre><code>if(pos == getCount() - 1){
      Log.i("Load", "Load database");
      load_database(getCount(), 5);
  }
  </code></pre>
  
  <p>and here is load_database()</p>
  
  <pre><code>private void load_database(long offset, long count) {
      ArrayList&lt;VKContent&gt; objs = BaseApplication.db.get_all(Message.class, MessageHandler.COLUMN_MAILBOX + " = " + mailbox, count, offset);
      for(VKContent obj: objs){
          adp.add((Message)obj);
      }
  }
  </code></pre>
  
  <p>The problem appeared right after that. On load it calls load_database once and everything is nice. ListView works fine. Clicks are handled. But once I reach "pos == getCount() - 1". It loads new data but it is now impossible to click items. When I scroll and do a flinch, a touch on the screen won't stop the flinch. When I try to scroll during a flinch it doesn't have any effect until the flinch stopped. </p>
  
  <p>If I switch to a different Tab the listview behavior is restored. If I try use my scroll ball to focus items, the normal behavior come back too. </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;TabHost xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:id="@android:id/tabhost"&gt; 
  
       &lt;LinearLayout 
    android:orientation="vertical"
    android:layout_height="match_parent"
    android:layout_width="match_parent"&gt;
  
           &lt;TabWidget android:id="@android:id/tabs"
               android:layout_height="wrap_content"
               android:layout_width="fill_parent" /&gt;
  
           &lt;FrameLayout android:id="@android:id/tabcontent"
               android:layout_height="fill_parent"
               android:layout_width="fill_parent"
               android:layout_weight="1"&gt;
              &lt;LinearLayout android:id="@+id/tab2"
                  android:orientation="vertical"
                  android:layout_height="fill_parent"
                  android:layout_width="fill_parent"&gt;
                  &lt;ListView android:id="@+id/lv"
                      android:layout_height="fill_parent"
                      android:layout_width="fill_parent"
                      android:clickable="true" /&gt;
              &lt;/LinearLayout&gt;
           &lt;/FrameLayout&gt; 
       &lt;/LinearLayout&gt;
  &lt;/TabHost&gt; 
  </code></pre>
  
  <p><strong>Edit</strong></p>
  
  <p>I did try to invalidate(), forceLayout(), requestLayout(), isFocusable()... bringToFront... and others after load_database. But nothing helped. </p>
  
  <p><strong>Edit2</strong>
  Almost forgot that piece of code. </p>
  
  <pre><code>    tabHost.setCurrentTab(1);
      tabHost.setCurrentTab(0);
  </code></pre>
  
  <p>For some reasons, there is a problem with TabHost. My ListView is shared by all tabs. When the view is first loaded it didn't display anything. So I had to switch from second to first tab.</p>