viewHolder could not be cast by viewHolder
<p>I'm trying to display 2 different item views depending on what I have in my Array list. Without the condition (if) there is no problem, but when I put the condition and so I have to deal with 2 viewHolders I get an error telling that viewHolder cannot be cast by viewHolder.</p>

<p>Here is my code :</p>

<pre><code>@Override
public View getView(int position, View view, ViewGroup parent) {

   bind(getItem(position), view);

   return view;
}


private void bind(final Eddystone eddystone, final View view) {

      List&lt;Content&gt; contents = ... ; 

      if(contents.get(i).content_type_id==2){

           ViewHolder holder = (ViewHolder) view.getTag();
           // some code here
      }
      else {

          ViewHolderVideo holder = (ViewHolderVideo) view.getTag();
          // some code here
      }

}
</code></pre>

<p>the error is on the second holder (in else condition).</p>

<p>Please remember when I remove the condition (the else) it works perfectly, and the class where this code is written is an adapter.</p>

<p>Please any help is welcome.</p>

<p>Thank you :)</p>