title: Android listview lagging with complex layout
body: <p>Like the title say, i create list view which each item display image, three line text, and a button, but the view is so lagging even in samsung galaxy mega dual core, here my item view xml</p>
  
  <pre><code>&lt;RelativeLayout
      android:gravity="center_vertical"
      android:padding="5.0dip"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:minHeight="?android:listPreferredItemHeight"
      xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;ImageView
          android:id="@+id/compositeListViewItemThumbnailImage"
          android:layout_width="60.0dip"
          android:layout_height="60.0dip"
          android:src="@drawable/ic_launcher"
          android:scaleType="fitCenter"
          android:layout_alignParentLeft="true"
          android:layout_alignParentTop="true"
          android:layout_alignWithParentIfMissing="true"
          android:contentDescription="@string/_empty_strings" /&gt;
      &lt;LinearLayout
          android:orientation="vertical"
          android:id="@+id/compositeListViewItemFirstLinearLayout"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_toRightOf="@+id/compositeListViewItemThumbnailImage"
          android:layout_alignTop="@+id/compositeListViewItemThumbnailImage"
          android:layout_alignBottom="@+id/compositeListViewItemThumbnailImage"
          android:layout_alignParentRight="true"&gt;
          &lt;TextView
              android:textSize="16.0sp"
              android:gravity="center_vertical"
              android:id="@+id/compositeListViewItemFirstLineText"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:text="@string/hello_world"
              android:singleLine="true"
              android:ellipsize="marquee"
              android:lines="1"
              android:inputType="textNoSuggestions" /&gt;
          &lt;TextView
              android:textSize="12.0sp"
              android:id="@+id/compositeListViewItemSecondLineText"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:text="@string/hello_world"
              android:singleLine="true"
              android:ellipsize="marquee"
              android:lines="1"
              android:inputType="textNoSuggestions" /&gt;
          &lt;TextView
              android:textSize="14.0sp"
              android:singleLine="true"
              android:ellipsize="marquee"
              android:lines="1"
              android:layout_gravity="center_vertical"
              android:id="@+id/compositeListViewItemThirdLineText"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:text="@string/hello_world"
              android:inputType="textNoSuggestions" /&gt;
      &lt;/LinearLayout&gt;
      &lt;Button
          android:id="@+id/compositeListViewItemActionButton"
          android:paddingLeft="5.0dip"
          android:paddingTop="5.0dip"
          android:paddingRight="5.0dip"
          android:paddingBottom="5.0dip"
          android:focusable="false"
          android:layout_width="wrap_content"
          android:layout_height="30.0dip"
          android:layout_marginTop="30.0dip"
          android:layout_marginRight="0.0dip"
          android:text="@string/hello_world"
          android:layout_alignParentRight="true"
          style="?android:attr/buttonStyleSmall" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>as it might / might not be affected by the adapter view, i also put it here</p>
  
  <pre><code>public class SimpleAdapter extends ArrayAdapter implements Serializable {
      private ArrayList&lt;?&gt; items;
      private int itemLayout;
      private String[] itemFieldsName;
      private int[] itemElements;
      private Context ctx;
  
      public SimpleAdapter(Context ctx, ArrayList&lt;?&gt; items, int itemLayout, int[] itemElements, String[] itemFieldsName) {
          super(ctx, itemLayout, items);
          this.items = items;
          this.itemElements = itemElements;
          this.itemLayout = itemLayout;
          this.itemFieldsName = itemFieldsName;
          this.ctx = ctx;
      }
  
      public View getView(int position, View convertView, ViewGroup parent) {
          View itemView = convertView;
          if (itemView == null) {
              itemView = ((LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(this.itemLayout, null);
          }
          Object item = this.items.get(position);
          for (int i = 0; i &lt; this.itemElements.length; i++) {
              Object value = getValue(item, Character.toUpperCase(this.itemFieldsName[i].charAt(0)) + this.itemFieldsName[i].substring(1));
              View elementView = null;
              if (itemView != null) {
                  elementView = itemView.findViewById(this.itemElements[i]);
                  if ((elementView instanceof TextView)) {
                      ((TextView) elementView).setText(value.toString());
                  } else if ((elementView instanceof SmartImageView)) {
                      ((SmartImageView) elementView).setImageUrl(value.toString());
                  } else if ((elementView instanceof Button)) {
                      ((Button) elementView).setText(value.toString());
                  }
              }
          }
          return itemView;
      }
  
      private Object getValue(Object obj, String fieldName) {
          ArrayList&lt;String&gt; fieldsName = new ArrayList&lt;String&gt;();
          int length;
          String str = Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1);
          Object value = new Object();
          try {
              value = obj.getClass().getMethod("get" + str, new Class[0]).invoke(obj);
          } catch (Exception ex) {
              value = fieldName;
          }
          return value;
      }
  
      private String trimString(String string, int length, boolean soft) {
          if(string == null || string.trim().isEmpty()){
              return string;
          }
          StringBuffer sb = new StringBuffer(string);
          int actualLength = length - 3;
          if(sb.length() &gt; actualLength){
              if(!soft)
                  return sb.insert(actualLength, "...").substring(0, actualLength+3);
              else {
                  int endIndex = sb.indexOf(" ",actualLength);
                  return sb.insert(endIndex,"...").substring(0, endIndex+3);
              }
          }
          return string;
      }
  }
  </code></pre>
  
  <p>Can someone tell me where i was wrong?, </p>
  
  <p>tell me if you need more explanation / code resource</p>