title: How to make the TextView invisible when there are items in listView?
body: <p>I like to display textView when there are no items in the listView whereas the textView will not display when there are items in the listView. My problem is even there are items in the listView, the textView still will be displayed in a short time and then load the items into listView. So, how to make the TextView invisible when there are items in listView? </p>
  
  <p>Here is the codes:</p>
  
  <pre><code> public void onCreate(Bundle savedInstancesState){
      super.onCreate(savedInstancesState);
      setContentView(R.layout.list_screen);
      user = getIntent().getExtras().getString("user");
      Log.d("dg",user);
      getList();
      lv = (ListView) findViewById(android.R.id.list);
      emptyText = (TextView)findViewById(android.R.id.empty);
      lv.setEmptyView(emptyText);       
  }
  
  public void getList(){
      new Thread(){
          public void run(){
              try{
                   httpclient = new DefaultHttpClient();
                   httppost = new HttpPost("http://www.kryptoquest.com/tracker/friendlist.php");
                   ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(1);
                   nameValuePairs.add(new BasicNameValuePair("Username", user));
                   httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                   response = httpclient.execute(httppost);
                   is = response.getEntity().getContent();
              }catch(Exception e){
                  Log.e("log_tag", "Error:"+e.toString());
              }
  
              //convert response to string
              try{
                      reader = new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8);
                      sb = new StringBuilder();
                      line = null;
                      while ((line = reader.readLine()) != null) {
  
                              sb.append(line + "\n");
  
                      }
                      Log.d("test",sb.toString());
                      is.close();
  
                      result = sb.toString();
  
                      result = result.substring(0, result.length()-1);                    
                  //    Log.d("result",result);
                      friend = new ArrayList&lt;String&gt;(Arrays.asList(result.split("[*]")));   
                    Log.d("size",String.valueOf(friend.size()));
                      runOnUiThread(new Runnable()
                      {
                          public void run(){
                              adapter = new ArrayAdapter&lt;String&gt;(ThirdActivity.this,android.R.layout.simple_list_item_1,friend);
                              setListAdapter(adapter); 
                          }
                      });
  
  
              }catch(Exception e){
                      Log.e("log_tag", "Error converting result "+e.toString());
              }
          }
      }.start();
  }
  </code></pre>
  
  <p>list_screen.xml</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    &gt;
  
  &lt;ListView android:id="@+id/android:list"
        android:layout_width="fill_parent"
          android:layout_height="fill_parent"/&gt;
  
  &lt;TextView   android:id="@+id/android:empty"
              android:layout_width="fill_parent" 
              android:layout_height="fill_parent"
              android:text="@string/no_friend"
              android:gravity="center_vertical|center_horizontal"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>