listview - select from parse not show the values in list view android -
i have code onlt select parse data, afer succedd wish show data in view made it, when set text views shows in app :
this code :
protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_sharing_board); parse.initialize(this, "******", "******"); //set listview arraylist<string> sharinglist = new arraylist<string>(); //create , populate arraylist of objects parse listadapter = new arrayadapter<view>(this, android.r.layout.simple_list_item_1); listview sharinglistview = (listview)findviewbyid(r.id.listview1); sharinglistview.setadapter(listadapter); final parsequery query = new parsequery("sharingboard"); inflater = (layoutinflater)this.getsystemservice(context.layout_inflater_service); query.findinbackground(new findcallback<parseobject>() { public void done(list<parseobject> objects, parseexception e) { if (e == null) { (int = 0; < objects.size(); i++) { object object = objects.get(i); string name = ((parseobject) object).getstring("name").tostring(); string part = ((parseobject) object).getstring("part").tostring(); string desc = ((parseobject) object).getstring("desc").tostring(); view view = inflater.inflate(r.layout.item_list, null); // add name view textview nametextview = (textview) view.findviewbyid(r.id.lblname); nametextview.settext(name); // add part view textview parttextview = (textview) view.findviewbyid(r.id.lblpart); parttextview.settext(part); // add desc view textview desctextview = (textview) view.findviewbyid(r.id.lbldesc); desctextview.settext(desc); listadapter.add(view); } } else { log.d("error", e.tostring()); toast.maketext(getapplicationcontext(), "error", toast.length_long).show(); } } });
what do wrong ? thanks...
you shouldn't add views listview
parse data.
if each cell in list text, simplest solution here.
if need more complex cell, 1 solution have layout resource lays out cell, put parsed data array, , have subclass of arrayadapter
override getview()
place content of each item corresponding views of cell. there's tutorial here.
Comments
Post a Comment