With regards this piece of the original code:
for (int i=1; i< vec.getCount(); i++)
... you might want to change that to this:
for(int i = 1; i <= vec.getCount(); i++)
.. in order to get a true reflection of the ViewEntryCollection object.
--
http://www.benpoole.com