private boolean convert(View convertView){
  if (cards.size() != 1) {
    Log.d("CardsUI","Can't convert view: amount of cards is " + cards.size());
    return false;
  }
  RelativeLayout container=(RelativeLayout)convertView.findViewById(R.id.stackContainer);
  if (container == null) {
    Log.d("CardsUI","Can't convert view: can't find stackContainer");
    return false;
  }
  if (container.getChildCount() != 1) {
    Log.d("CardsUI","Can't convert view: child count is " + container.getChildCount());
    return false;
  }
  Card card=cards.get(0);
  View convertCardView=container.getChildAt(0);
  if (convertCardView == null || convertCardView.getId() != card.getId()) {
    Log.d("CardsUI",String.format("Can't convert view: child Id is 0x%x, card Id is 0x%x",convertCardView.getId(),card.getId()));
    return false;
  }
  if (card.convert(convertCardView))   return true;
  return false;
}

private boolean convert ( View convertView ) { if ( cards . size ( ) != 1 ) { Log . d ( "CardsUI" , "Can't convert view: amount of cards is " + cards . size ( ) ) ; return false ; } RelativeLayout container = ( RelativeLayout ) convertView . findViewById ( R . id . stackContainer ) ; if ( container == null ) { Log . d ( "CardsUI" , "Can't convert view: can't find stackContainer" ) ; return false ; } if ( container . getChildCount ( ) != 1 ) { Log . d ( "CardsUI" , "Can't convert view: child count is " + container . getChildCount ( ) ) ; return false ; } Card card = cards . get ( 0 ) ; View convertCardView = container . getChildAt ( 0 ) ; if ( convertCardView == null || convertCardView . getId ( ) != card . getId ( ) ) { Log . d ( "CardsUI" , String . format ( "Can't convert view: child Id is 0x%x, card Id is 0x%x" , convertCardView . getId ( ) , card . getId ( ) ) ) ; return false ; } if ( card . convert ( convertCardView ) ) return true ; return false ; }
attempt to modify the convertview instead of inflating a new view for this cardstack . if convertview isn ' t compatible , it isn ' t modified .
