title: Android list view shows blank elements
body: <p>In my App i download a list of strings from the web</p>
  
  <p>then i'm using AsyncTask to update the listview on my activity.
  at prePostExecute im creating the array adapter(private member)</p>
  
  <p>at doInBackground i download the list and return it</p>
  
  <p>at onPostExecute i set the returned list to the adapter and then connects the listview and the adapter</p>
  
  <p>in my activity i see just 1 blank element(instead of 2 elements) , when i click it i can see the Text but when im not its blank.</p>
  
  <p>also , when my adapter is not android.R.layout.simple_list_1 but android.R.layout.acitiviy_list_item (and 2 other templates) i can see 2 elements with visible text but the text is small and gray</p>
  
  <p><strong>code:
  XML:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/parent"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:focusable="true"
      android:focusableInTouchMode="true"
      android:orientation="vertical" &gt;
  
      &lt;TableRow
          android:id="@+id/tableRow0"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:paddingBottom="5dip" &gt;
  
          &lt;TextView
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:layout_gravity="center"
              android:background="#4CB8FB"
              android:gravity="center"
              android:text="Search"
              android:textColor="#FAFAFA"
              android:textSize="40sp" /&gt;
      &lt;/TableRow&gt;
  
      &lt;EditText
          android:id="@+id/searchInput"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:drawableLeft="@drawable/ic_btn_search" /&gt;
  
      &lt;ListView
          android:id="@+id/list"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:fastScrollEnabled="true"
          android:scrollingCache="true" &gt;
      &lt;/ListView&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>code Behind</strong></p>
  
  <pre><code>public class ProductPickerActivity extends Activity {
      private ListView listView;
      private EditText inputSearch;
      private ArrayAdapter&lt;String&gt; adapter;
      private final Integer PRODUCT_REQUEST_ID = 5;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          setContentView(R.layout.activity_product_listview);
  
          inputSearch = (EditText) findViewById(R.id.searchInput);
  
          inputSearch.addTextChangedListener(new TextWatcher() {
  
              @Override
              public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) {
                  // When user changed the Text
                  ProductPickerActivity.this.adapter.getFilter().filter(cs);
              }
  
              @Override
              public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
              }
  
              @Override
              public void afterTextChanged(Editable arg0) {
              }
          });
          new InitializeUi().execute(this);
          setupUI(findViewById(R.id.parent));
      }
  
      private class InitializeUi extends AsyncTask&lt;Object, Void, List&lt;IProduct&gt;&gt; {
          @Override
          protected void onPreExecute() {
              // Get ListView object from xml
              listView = (ListView) findViewById(R.id.list);
  
              // Define a new Adapter
              // First parameter - Context
              // Second parameter - Layout for the row
              // Third parameter - ID of the TextView to which the data is written
              // Forth - the Array of data
  
              adapter = new ArrayAdapter&lt;String&gt;(getApplicationContext(), android.R.layout.activity_list_item, new ArrayList&lt;String&gt;());
  
              // ListView Item Click Listener
              listView.setOnItemClickListener(new OnItemClickListener() {
  
                  @Override
                  public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                      // ListView Clicked item index
                      int itemPosition = position;
  
                      // ListView Clicked item value
                      String itemValue = (String) listView.getItemAtPosition(position);
  
                      Intent intent = new Intent(getApplicationContext(), ProductViewActivity.class);
                      intent.putExtra("ProductName", itemValue);
                      startActivityForResult(intent, PRODUCT_REQUEST_ID);
                  }
  
              });
          }
  
          @Override
          protected List&lt;IProduct&gt; doInBackground(Object... params) {
              // Defined Array values to show in ListView
              IProductManager manager = new ProductManager(getApplicationContext());
              // download from web
              List&lt;IProduct&gt; lst = manager.GetProductList();
              return lst;
          }
  
          @Override
          protected void onPostExecute(List&lt;IProduct&gt; lst) {
  
              String[] values = new String[lst.size()];
              Integer i = 0;
  
              for (IProduct p : lst) {
                  values[i] = p.getName();
                  i = i + 1;
                  Log.d("ProductPickerActivity", "Got Values : " + p.getName());
  
                  adapter.add(p.getName());
  
                  adapter.notifyDataSetChanged();
  
              }
  
              // Assign adapter to ListView
              listView.setAdapter(adapter);
  
              adapter.notifyDataSetChanged();
  
              ((BaseAdapter) listView.getAdapter()).notifyDataSetChanged();
  
              listView.refreshDrawableState();
  
          }
  
      }
  }
  </code></pre>