title: Check whether custom EllipsizingTextView is ellipsized from ListView getView
body: <p>I would like to create an expandable TextView which is shown in a <code>ListView</code>. In my <code>ListView</code> <code>Adapter</code>'s <code>getView</code> method I need to check whether a TextView is ellipsized to display an "expand" button.</p>
  
  <p>I am using <a href="https://github.com/triposo/barone/blob/master/src/com/triposo/barone/EllipsizingTextView.java" rel="nofollow">EllipsizingTextView</a> due to a <a href="http://code.google.com/p/android/issues/detail?id=2254" rel="nofollow">bug</a> in older Android versions.</p>
  
  <p>EllipsizingTextView provides a method called <code>isEllipsized</code>. When I call this method in my <code>getView</code> method for the EllipsizingTextView I always get <code>false</code> as result. As I found out, the  <code>isEllipsized</code> method only works for views that have already been drawn.</p>
  
  <p>As a result I tried to invoke <code>isEllipsized</code> from a separate <code>Runnable</code> using <code>TextView.post(Runnable runnable)</code>. This works for the first items displayed in the EllipsizingTextView after first load of list items. </p>
  
  <p>However, when I scroll down <code>isEllipsized</code> always returns false. When I then scroll up again <code>isEllipsized</code> returns the correct boolean value for each list item.</p>
  
  <p>Does anyone know what I am doing wrong? Thanks for any hints.</p>
  
  <p>Here is my getView method which I have in a separate Class:</p>
  
  <pre><code>private EllipsizingTextView textView;
  private int position;
  
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
      ViewHolder holder = null;
  
      if (convertView == null) {
          holder = new ViewHolder();
          convertView = inflater.inflate(R.layout.list_item, null, false); 
          holder.text = (EllipsizingTextView) convertView.findViewById(R.id.label);       
          convertView.setTag(holder);
      } else {
          holder = (ViewHolder) convertView.getTag();
      } 
  
      holder.text.setText(position + " " + this.text);
  
      this.textView = holder.text;
      this.position = position;
  
      Runnable r = new Runnable() {
          @Override
          public void run() {
              Log.d("tag", TestObject.this.position +
                      " isEllipsized " + TestObject.this.textView.isEllipsized());
          }
      };
      holder.text.post(r);
  
      return convertView;
  }
  </code></pre>
  
  <p>and my XML:</p>
  
  <pre><code>&lt;com.example.listviewtest.EllipsizingTextView
    android:id="@+id/label"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:ellipsize="end"
    android:maxLines="5"
  &lt;/com.example.listviewtest.EllipsizingTextView&gt;
  </code></pre>