title: Android ListView Text Disappears on Load
body: <p>When my Activity Loads on Samsung Galaxy Y and Ace Plus - mDPI/Ldpi Screens. The List View Text and Content doesnt load. On Touching and trying to scroll the Content appears.</p>
  
  <p>But it works perfectly on my Development Phone Samsung S2</p>
  
  <p>After some Testing i found that this is happening only on 2.X version of Android.</p>
  
  <p><img src="https://i.stack.imgur.com/5AQFe.jpg" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/mNdRN.jpg" alt="enter image description here"></p>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>private final String[] places = new String[] { "Mysore", "Bangalore",
          "Mangalore", "Wayanad", "Bandipur National Park National Park",
          "Chickmaglur", "Bandipura", "Coorg", "Kodaikanal", "Hampi",
          "Ghati Subramanya", "Mekedatu", "Muththathhi", "Shivasamudram",
          "Talakadu", "Savana Durga" };
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
      setContentView(R.layout.activity_main);
  
      context = this;
  
      Log.i("Nomad", "onCreate");
  
      List&lt;Place&gt; thePlaces = new ArrayList&lt;Place&gt;();
      for (int i = 0; i &lt; places.length; i++) {
          Place pl = new Place("NO_ID", places[i], "NO_DISTANCE",
                  "NO_CATEGORYICON");
          thePlaces.add(pl);
      }
  
      listView = (ListView) findViewById(R.id.place_list);
      listView.setEmptyView(findViewById(R.id.empty));
  
      adapter = new PlacesListAdapter(MainActivity.this,
              R.layout.list_item_place, thePlaces);
  
      listView.setAdapter(adapter);
      listView.setTextFilterEnabled(true);
  
      mSearchView = (SearchView) findViewById(R.id.action_search);
  
      listView.setOnItemClickListener(new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView&lt;?&gt; a, View view, int position,
                  long id) {
  
              startActivity(new Intent(MainActivity.this, PlaceActivity.class));
          }
      });
  
  }
  </code></pre>
  
  <p><strong>PlacesListAdapter.java</strong></p>
  
  <pre><code>public class PlacesListAdapter extends ArrayAdapter&lt;Place&gt; implements
          Filterable {
      public Context context;
      private List&lt;Place&gt; orig, itemDetailsrrayList;
      private PlaceFilter filter;
  
      public PlacesListAdapter(Context context, int textViewResourceId) {
          super(context, textViewResourceId);
      }
  
      public PlacesListAdapter(Context context, int resource, List&lt;Place&gt; places) {
          super(context, resource, places);
          this.context = context;
          // this.places = places;
  
          itemDetailsrrayList = places;
          orig = new ArrayList&lt;Place&gt;(itemDetailsrrayList);
  
          filter = new PlaceFilter();
          // imageLoader = new ImageLoader(context.getApplicationContext());
  
      }
  
      public int getCount() {
          return itemDetailsrrayList.size();
      }
  
      public Place getItem(int position) {
          return itemDetailsrrayList.get(position);
      }
  
      public long getItemId(int position) {
          return position;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
  
          ViewHolder holder;
          // View view = convertView;
          // Place p = places.get(position);
  
          if (convertView == null) {
              LayoutInflater viewInflater;
              viewInflater = LayoutInflater.from(getContext());
              convertView = viewInflater.inflate(R.layout.list_item_place, null);
  
              holder = new ViewHolder();
              holder.placeTitle = (TextView) convertView
                      .findViewById(R.id.place_title);
              holder.placeDistance = (TextView) convertView
                      .findViewById(R.id.place_distance);
              holder.placeCategoryIcon = (ImageView) convertView
                      .findViewById(R.id.place_category_icon);
  
              convertView.setTag(holder);
  
          } else {
              holder = (ViewHolder) convertView.getTag();
          }
  
          holder.placeTitle.setText(itemDetailsrrayList.get(position)
                  .getPlaceTitle());
          holder.placeDistance.setText("200");
          holder.placeCategoryIcon.setImageResource(R.drawable.icon_category);
  
          // Setting Alternative Row Colors
          if (position % 2 == 0) {
              convertView.setBackgroundResource(R.drawable.list_view_place_row_1);
          } else {
              convertView.setBackgroundResource(R.drawable.list_view_place_row_2);
          }
  
          return convertView;
      }
  
      static class ViewHolder {
          TextView placeId;
          TextView placeTitle;
          TextView placeDistance;
          ImageView placeCategoryIcon;
      }
  
      @Override
      public Filter getFilter() {
          // TODO Auto-generated method stub
          return filter;
      }
  
      private class PlaceFilter extends Filter {
  
          @Override
          protected FilterResults performFiltering(CharSequence constraint) {
              FilterResults oReturn = new FilterResults();
              ArrayList&lt;Place&gt; results = new ArrayList&lt;Place&gt;();
              if (orig == null)
                  orig = itemDetailsrrayList;
              if (constraint != null) {
                  if (orig != null &amp;&amp; orig.size() &gt; 0) {
                      for (Place g : orig) {
                          if (g.getPlaceTitle()
                                  .toLowerCase()
                                  .startsWith(constraint.toString().toLowerCase()))
                              results.add(g);
                      }
                  }
                  oReturn.values = results;
              }
              return oReturn;
          }
  
          @SuppressWarnings("unchecked")
          @Override
          protected void publishResults(CharSequence constraint,
                  FilterResults results) {
              itemDetailsrrayList = (ArrayList&lt;Place&gt;) results.values;
              notifyDataSetChanged();
          }
  
      }
  }
  </code></pre>
  
  <p><strong>acitivty_main.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:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:background="@color/primary_white"
      android:orientation="vertical" &gt;
  
      &lt;ListView
          android:id="@+id/place_list"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:cacheColorHint="#00000000"
          android:fadingEdge="none" &gt;
      &lt;/ListView&gt;
  
      &lt;TextView
          android:id="@+id/empty"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:gravity="center"
          android:padding="20dp"
          android:text="@string/list_view_place_empty"
          android:textColor="@color/black"
          android:textSize="18sp" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>List View Row XML</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:paddingBottom="10dp"
      android:paddingTop="10dp" &gt;
  
      &lt;ImageView
          android:id="@+id/place_category_icon"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerVertical="true"
          android:contentDescription="ss"
          android:paddingLeft="10dp"
          android:paddingRight="15dp"
          android:src="@drawable/icon_category" /&gt;
  
      &lt;TextView
          android:id="@+id/place_distance"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentRight="true"
          android:layout_centerVertical="true"
          android:paddingRight="15dp"
          android:text="320" /&gt;
  
      &lt;TextView
          android:id="@+id/place_title"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerVertical="true"
          android:layout_toRightOf="@+id/place_category_icon"
          android:ellipsize="end"
          android:paddingRight="50dp"
          android:singleLine="true"
          android:text="Place Name"
          android:textColor="#191919"
          android:textSize="18sp" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Found this in the Logcat</p>
  
  <pre><code>12-23 19:58:28.033: E/ResourceType(631): Style contains key with bad entry: 0x010102f3
  12-23 19:58:28.083: E/ResourceType(631): Style contains key with bad entry: 0x0101030b
  12-23 19:58:28.083: E/ResourceType(631): Style contains key with bad entry: 0x0101039c
  12-23 19:58:28.083: E/ResourceType(631): Style contains key with bad entry: 0x010103e1
  12-23 19:58:31.852: E/ResourceType(631): Style contains key with bad entry: 0x010102f3
  12-23 19:58:31.852: E/ResourceType(631): Style contains key with bad entry: 0x0101030b
  12-23 19:58:31.852: E/ResourceType(631): Style contains key with bad entry: 0x0101039c
  12-23 19:58:31.852: E/ResourceType(631): Style contains key with bad entry: 0x010103e1
  12-23 19:58:31.934: I/Nomad(631): onCreate
  12-23 19:58:32.074: I/Nomad(631): onCreateOptionsMenu
  12-23 19:58:32.144: D/dalvikvm(631): GC_EXTERNAL_ALLOC freed 140K, 50% free 2834K/5639K, external 2844K/2844K, paused 59ms
  12-23 19:58:32.264: I/Nomad(631): after setupSearchView()
  12-23 19:58:32.264: W/KeyCharacterMap(631): No keyboard for id -1
  12-23 19:58:32.264: W/KeyCharacterMap(631): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
  12-23 19:58:32.473: D/dalvikvm(631): GC_EXTERNAL_ALLOC freed 41K, 50% free 2847K/5639K, external 3060K/3369K, paused 60ms
  </code></pre>
  
  <p><strong>color.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;resources&gt;
  
      &lt;color name="white"&gt;#FFFFFF&lt;/color&gt;
      &lt;color name="black"&gt;#333333&lt;/color&gt;
      &lt;color name="primary_white"&gt;#f2f2f2&lt;/color&gt;
      &lt;color name="dark_bg"&gt;#161616&lt;/color&gt;
  
      &lt;!-- Place List View --&gt;
      &lt;color name="list_view_place_row_1"&gt;#f2f2f2&lt;/color&gt;
      &lt;color name="list_view_place_row_2"&gt;#e7e7e7&lt;/color&gt;
      &lt;color name="list_view_place_selected"&gt;#CFCFCF&lt;/color&gt;
  
      &lt;!-- Place List View --&gt;
      &lt;color name="primary_color"&gt;#E5492A&lt;/color&gt;
      &lt;color name="primary_color_inverse"&gt;#c33518&lt;/color&gt;
  
  &lt;/resources&gt;
  </code></pre>
  
  <p><strong>styles.xml</strong></p>
  
  <pre><code>&lt;resources xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
      &lt;!-- Nomad Theme --&gt;
      &lt;style name="Theme.Nomad" parent="Theme.Sherlock.Light"&gt;
          &lt;item name="android:actionBarStyle"&gt;@style/Widget.Nomad.ActionBar&lt;/item&gt;
          &lt;item name="actionBarStyle"&gt;@style/Widget.Nomad.ActionBar&lt;/item&gt;
          &lt;item name="android:actionBarItemBackground"&gt;@drawable/actionbar_selectable_background&lt;/item&gt;
          &lt;item name="actionBarItemBackground"&gt;@drawable/actionbar_selectable_background&lt;/item&gt;
          &lt;item name="android:actionBarTabStyle"&gt;@style/MyActionBarTabStyle&lt;/item&gt;
          &lt;item name="actionBarTabStyle"&gt;@style/MyActionBarTabStyle&lt;/item&gt;
          &lt;item name="android:homeAsUpIndicator"&gt;@drawable/abs__ic_ab_back_holo_light&lt;/item&gt;
          &lt;item name="homeAsUpIndicator"&gt;@drawable/abs__ic_ab_back_holo_light&lt;/item&gt;
          &lt;item name="*android:actionModeShareDrawable"&gt;@drawable/ic_menu_share&lt;/item&gt;
          &lt;item name="actionModeShareDrawable"&gt;@drawable/ic_menu_share&lt;/item&gt;
          &lt;item name="searchViewSearchIcon"&gt;@drawable/ic_menu_search&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;style name="Widget.Nomad.ActionBar" parent="Widget.Sherlock.ActionBar"&gt;
          &lt;item name="android:background"&gt;#E5492A&lt;/item&gt;
          &lt;item name="background"&gt;#E5492A&lt;/item&gt;
          &lt;item name="android:titleTextStyle"&gt;@style/TitleText&lt;/item&gt;
          &lt;item name="titleTextStyle"&gt;@style/TitleText&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;style name="TitleText" parent="TextAppearance.Sherlock.Widget.ActionBar.Title"&gt;
          &lt;item name="android:textColor"&gt;@color/white&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;style name="MyActionBarTabStyle" parent="Widget.Sherlock.Light.ActionBar.TabBar"&gt;
          &lt;item name="android:background"&gt;@drawable/actionbar_tab_bg&lt;/item&gt;
          &lt;item name="android:textAlignment"&gt;center&lt;/item&gt;
          &lt;item name="android:gravity"&gt;center&lt;/item&gt;
      &lt;/style&gt;
  
  &lt;/resources&gt;
  </code></pre>