android - Retrieving an Image from parse.com in a List View using an Array Adapter -
i have searched throughout answer none answer question. have data stored on parse.com. trying retrieve image , string , place in list view. have adapter have been using grab text unsure how image. there 1 line in particular need with.
public class appetizeradapter extends arrayadapter { protected context mcontext; protected list mappetizer; public appetizeradapter(context context, list appetizer) { super(context, r.layout.custom_appetizers, appetizer); mcontext = context; mappetizer = appetizer; } // inflates each row of app @override public view getview(final int position, view convertview, viewgroup parent) { // initialize view holder viewholder holder; if (convertview == null) { // if no items in view displayed convertview = layoutinflater.from(mcontext).inflate( r.layout.custom_appetizers, null); // initialize views holder = new viewholder(); // creates new view holder.appetizer = (textview) convertview // calls view .findviewbyid(r.id.appetizer); holder = new viewholder(); holder.appetizerimage = (imageview) convertview .findviewbyid(r.id.appetizerimage); // call view , settag parameter (holder) convertview.settag(holder); } else { // if view displayed // initialize holder holder = (viewholder) convertview.gettag(); } // position of row parseobject appetizerobject = (parseobject) mappetizer.get(position); // title string appetizers = appetizerobject.getstring("appetizers"); holder.appetizer.settext(appetizers); // image ??? holder.appetizerimage.setimageresource(); return convertview; // return view } public static class viewholder { // declaration of variables textview appetizer; imageview appetizerimage; }
the part having problem is: // title string appetizers = appetizerobject.getstring("appetizers"); <- allows me store string in column "appetizers" - string, image, not sure how code this.
any appreciated. thank in advance
assuming can image's url appetizerobject
reference, need download bitmap network , set imageview's bitmap.
while there many ways implement manually, recommend using library manage both download , caching process. experience, have used following libraries:
both of them have simple (and similar) api.
Comments
Post a Comment