(Despite the fact that a year ago I came here through Google)
Something tells me that you have too many views downloaded immediately, and Android cannot track them all. * It sounded like it wasn’t right to use ListView, that many of us are guilty. Assuming you have an adapter adapter:
public abstract View getView (int position, View convertView, ViewGroup parent)
When you overload this function, always check convertView.
public abstract View getView (int position, View convertView, ViewGroup parent) { View view = convertView; if ( view == null ) {
Android has a “recycle” mechanism for list views, and it will reuse views, if possible. In other words, instead of creating several different views, it will capture the old view from the basket.
In your case, you have 10 different types. If they are very similar, you can supervise and enable or disable parts of the view (for example, subView.setVisibility (View.GONE)). Just watch out for massive if blocks. I have not used them before, but you should research
public abstract int getItemViewType (int position) public abstract int getViewTypeCount ()
That would be better, because you do not need to deal with extra fluff, and it should be automatically controlled by Android
- Personally, I am not 100% sure that this may be so, but I have the feeling that he has a 66% chance of this.
source share