Cursor Adapter and GalleryView on Android -


all- has used cursoradapter gallery widget? there plenty of examples out there showing gallery , baseadapter(array) data store.

my use-case driving gallery sqlite cursor. cursor has imageurl display.

i have been using droidfu's imageloader(with imageview) in other listviews async download images.

but doesnt seem working gallery. it(gallery) doesnt handler posting it.

so... thoughts of gallery , cursor adapter pattern asyncdownload of url based images?

thanks

yes, used own implementation of image loader, similar droidfu (with in-memory/file caching, threaded , none-threaded image loading). , seem can't load image threads gallery+cursor adapter setup, or else choppy scrolling, instead of 1 continuous smooth scrolling.

here sample code, use same cursor adapter list, gallery, , grid views.

public class catalogcursoradapter extends cursoradapter {  private context context = null; private hlbitmapmanager iman; private catalogviewholder holder; private final layoutinflater inflater; private int layout;  public catalogcursoradapter(context context, cursor c, int layout) {     super(context, c, true);     inflater = layoutinflater.from(context);     this.layout = layout;     this.context = context;     iman = new hlbitmapmanager(context.getcachedir()); }  @override public view newview(context context, cursor cursor, viewgroup parent) {     final view view = inflater.inflate(layout, parent, false);             return view; }  @override public void bindview(view v, context context, cursor c) {      string brandname = c.getstring(c.getcolumnindex("display_name"));     string category = c.getstring(c.getcolumnindex("display_price"));     string imgurl = c.getstring(c.getcolumnindex("img_url"));      holder = (catalogviewholder) v.gettag();     if(holder == null) {         holder = new catalogviewholder(v);         v.settag(holder);     }      bitmap image;     switch (this.layout) {     case r.layout.catalog_list_row:         holder.title.settext(brandname);         holder.sub_title.settext(category);         iman.fetchbitmaponthread(imgurl, constants.event_listview_img_width, constants.event_listview_img_height, holder.icon);         break;     case r.layout.catalog_grid_cell:         iman.fetchbitmaponthread(imgurl, constants.event_listview_img_width, constants.event_listview_img_height, holder.icon);         break;     case r.layout.catalog_slide_cell:         image = iman.fetchbitmap(imgurl, constants.event_listview_img_width, constants.event_listview_img_height);         holder.icon.setimagebitmap(image);         break;     }     holder.icon.setscaletype(imageview.scaletype.center_inside);  } } 

Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -