I am new to Android. I am creating a gallery of webviews, there I have to show 200 webview content in the BaseAdapter. I 开发者_如何转开发do not want to load all the 200 webviews together. So on slide of the gallery I will add each webviews to BaseAdapter and will remove the shown webviews, then I will refresh the BaseAdapter with "notifydatasetchanged ()"
Here the issue Im facing is; when I update the BaseAdapter on "notifydatasetchanged()" the gallery gets refreshed, At the moment of refreshing the gallery get blinks. I want to remove the blinking on refreshing the BaseAdapter. Is it Possible ?
Thanks in Advance :)
I just corrected it in my app :)
I will try to explain with my legendary English.
BaseAdapter.notifyDataSetChanged()
calls Adapter.getView(...)
for all displayed views.
So you just have to handle it in your Overridden method (in my case i put a business object in view.Tag) :
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// View is good to use
if (convertView != null && convertView.getTag() != null && convertView.getTag() == getItem(position)){
return convertView;
}else {
//Do your stuff
convertView.setTag(getItem(position))
return convertView;
}
}
I hope it will help someone even 3 years later :)
精彩评论