Look at and implement these methods: http://developer.android.com/reference/android/widget/Adapter.html#getItemViewType(int) http://developer.android.com/reference/android/widget/Adapter.html#getViewTypeCount()
Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Thu, Jul 26, 2012 at 4:59 AM, Sergio Panico <sergio.pan...@gmail.com>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 android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en