Sure sounds like a bug in getView. Make sure getView works when
position==5 and position==6.
On Thursday, July 26, 2012 5:59:05 AM UTC-5, Sergio Panico wrote:
>
> Hi all,
> I need your help to understand the refresh behaviour of a ListView where
> I've defined a my custom view for the ListView's items.
>
> I think It's better explain it with an example:
> my adapter contains 7 items: A, B, C, D, E, F, G correctly initialized,
> filled and working. The associated ListView shows 5 (out of 7) items: A, B,
> C, D, E.
> The problem is that, when I scroll down the ListView's content instead of
> showing me items F and G, I've got A and B items again. I understood that
> this is "only" a viewing issue becouse the model elements associated with
> the last two items, correctly belong to F and G items. :|
>
> Following the ovveride of getView(...) method of my adapter (extending
> BaseAdapter):
>
> @Override
> public View getView(int position, View convertView, ViewGroup parent) {
> MyItemView miv = (( MyItemView ) convertView);
>
> if (context == null) return null;
>
> if (convertView == null) {
> miv = new MyItemView (........);
> .....
> } else {
> miv.refreshView(); //refresh the view content
> }
>
> return miv;
> }
>
> and the refreshView() method of MyItemView (extending LinearLayout):
>
> @Override
> public void refreshView() {
> label1.setText(......);
> label2.setText(......);
> label2.setText(......);
>
> invalidate();
> }
>
> Thanks a lot to all!
> Bye
> Sergio
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en