In my application I am using a CustomListView
with an ArrayAdapter
to show different countries time. But after 6 to 7 rows(depending on the phone scree
ListViews recycle views, which means at first a base set of list entries is inflated from XML. When you scroll down now, one list entry gets hidden at the top, and a new one gets shown at the bottom. At this moment getView()
is called with a non-null argument convertView
, because an already inflated view is reused.
In your case that means that the whole layout inflation/setup is skipped (the if (v == null)
tree). Which is fine, basically all you have to do is update the timestamp in the second if section (o != null
).
It should contain something similar to this, like you did with the textviews too:
CustomAnalogClock customAC = (CustomAnalogClock) v.findViewById(R.id.yourclockid);
customAC.setTime(o.getOrderTime());
This means that you have to assign an ID (by using setId()
) to your view while adding it to the layout, and also have to have a setTime()
method ready.