android - Populating a ListView with parse.com -



android - Populating a ListView with parse.com -

i'm building app display the values column "namemessage" table/class "messages" parse.com app called : "parsequeryadapter" on click of "display" button. nil happens when display button clicked, , app crashes when display button clicked 2nd time. i'm attaching logcat. please help. thanks

import java.util.arraylist; import java.util.list; import android.app.activity; import android.content.context; import android.location.location; import android.location.locationlistener; import android.location.locationmanager; import android.os.bundle; import android.util.log; import android.view.view; import android.view.view.onclicklistener; import android.widget.arrayadapter; import android.widget.baseadapter; import android.widget.button; import android.widget.edittext; import android.widget.listview; import com.parse.findcallback; import com.parse.parse; import com.parse.parseexception; import com.parse.parseobject; import com.parse.parsequery; import com.parse.parsequeryadapter; public class mainactivity extends activity { private parsequeryadapter<parseobject> mainadapter; private listview listview; private edittext textname; private edittext textmessage; private button buttonsendinfo; public double plong; public double plat; private button buttondisplay; arraylist<string> messagesarray = new arraylist<string>(); private listview lv; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); parse.initialize(this, *hidden safety*); textname = (edittext)findviewbyid(r.id.edittextname); textmessage = (edittext)findviewbyid(r.id.edittextmessage); buttonsendinfo = (button)findviewbyid(r.id.buttonsend); buttondisplay = (button)findviewbyid(r.id.togglebutton); buttondisplay.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { populatelist(); } } protected void populatelist() { lv = (listview) findviewbyid(r.id.mylist); parsequery<parseobject> query = parsequery.getquery("messages"); query.findinbackground(new findcallback<parseobject>(){ @override public void done(list<parseobject> namemessage, parseexception e) { if (e == null){ for(int = 0;i<namemessage.size();i++){ messagesarray.add(namemessage.get(i).tostring()); } } else {log.d("messages","error:"+e.getmessage());} } }); listview list = (listview) findviewbyid(r.id.mylist); lv.setadapter(new arrayadapter<string>(mainactivity.this,r.id.mylist,r.layout.list_item,messagesarray)); } }

logcat:

10-14 04:53:02.205: e/androidruntime(912): android.content.res.resources$notfoundexception: resource id #0x7f080007 type #0x12 not valid 10-14 04:53:02.205: e/androidruntime(912): @ android.content.res.resources.loadxmlresourceparser(resources.java:2309) 10-14 04:53:02.205: e/androidruntime(912): @ android.content.res.resources.getlayout(resources.java:934) 10-14 04:53:02.205: e/androidruntime(912): @ android.view.layoutinflater.inflate(layoutinflater.java:395) 10-14 04:53:02.205: e/androidruntime(912): @ android.widget.arrayadapter.createviewfromresource(arrayadapter.java:371) 10-14 04:53:02.205: e/androidruntime(912): @ android.widget.arrayadapter.getview(arrayadapter.java:362) 10-14 04:53:02.205: e/androidruntime(912): @ android.widget.abslistview.obtainview(abslistview.java:2177) 10-14 04:53:02.205: e/androidruntime(912): @ android.widget.listview.makeandaddview(listview.java:1840) 10-14 04:53:02.205: e/androidruntime(912): @ android.widget.listview.filldown(listview.java:675) 10-14 04:53:02.205: e/androidruntime(912): @ android.widget.listview.fillfromtop(listview.java:736) 10-14 04:53:02.205: e/androidruntime(912): @ android.widget.listview.layoutchildren(listview.java:1655) 10-14 04:53:02.205: e/androidruntime(912): @ android.widget.abslistview.onlayout(abslistview.java:2012) 10-14 04:53:02.205: e/androidruntime(912): @ android.view.view.layout(view.java:14289) 10-14 04:53:02.205: e/androidruntime(912): @ android.view.viewgroup.layout(viewgroup.java:4559) 10-14 04:53:02.205: e/androidruntime(912): @ android.widget.relativelayout.onlayout(relativelayout.java:1076) 10-14 04:53:02.205: e/androidruntime(912): @ android.view.view.layout(view.java:14289) 10-14 04:53:02.205: e/androidruntime(912): @ android.view.viewgroup.layout(viewgroup.java:4559) 10-14 04:53:02.205: e/androidruntime(912): @ android.widget.framelayout.onlayout(framelayout.java:448) 10-14 04:53:02.205: e/androidruntime(912): @ android.view.view.layout(view.java:14289) 10-14 04:53:02.205: e/androidruntime(912): @ android.view.viewgroup.layout(viewgroup.java:4559) 10-14 04:53:02.205: e/androidruntime(912): @ com.android.internal.widget.actionbaroverlaylayout.onlayout(actionbaroverlaylayout.java:349) 10-14 04:53:02.205: e/androidruntime(912): @ android.view.view.layout(view.java:14289) 10-14 04:53:02.205: e/androidruntime(912): @ android.view.viewgroup.layout(viewgroup.java:4559) 10-14 04:53:02.205: e/androidruntime(912): @ android.widget.framelayout.onlayout(framelayout.java:448) 10-14 04:53:02.205: e/androidruntime(912): @ android.view.view.layout(view.java:14289) 10-14 04:53:02.205: e/androidruntime(912): @ android.view.viewgroup.layout(viewgroup.java:4559) 10-14 04:53:02.205: e/androidruntime(912): @ android.view.viewrootimpl.performlayout(viewrootimpl.java:1976) 10-14 04:53:02.205: e/androidruntime(912): @ android.view.viewrootimpl.performtraversals(viewrootimpl.java:1730) 10-14 04:53:02.205: e/androidruntime(912): @ android.view.viewrootimpl.dotraversal(viewrootimpl.java:1004) 10-14 04:53:02.205: e/androidruntime(912): @ android.view.viewrootimpl$traversalrunnable.run(viewrootimpl.java:5481) 10-14 04:53:02.205: e/androidruntime(912): @ android.view.choreographer$callbackrecord.run(choreographer.java:749) 10-14 04:53:02.205: e/androidruntime(912): @ android.view.choreographer.docallbacks(choreographer.java:562) 10-14 04:53:02.205: e/androidruntime(912): @ android.view.choreographer.doframe(choreographer.java:532) 10-14 04:53:02.205: e/androidruntime(912): @ android.view.choreographer$framedisplayeventreceiver.run(choreographer.java:735) 10-14 04:53:02.205: e/androidruntime(912): @ android.os.handler.handlecallback(handler.java:730) 10-14 04:53:02.205: e/androidruntime(912): @ android.os.handler.dispatchmessage(handler.java:92) 10-14 04:53:02.205: e/androidruntime(912): @ android.os.looper.loop(looper.java:137) 10-14 04:53:02.205: e/androidruntime(912): @ android.app.activitythread.main(activitythread.java:5103) 10-14 04:53:02.205: e/androidruntime(912): @ java.lang.reflect.method.invokenative(native method) 10-14 04:53:02.205: e/androidruntime(912): @ java.lang.reflect.method.invoke(method.java:525) 10-14 04:53:02.205: e/androidruntime(912): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:737) 10-14 04:53:02.205: e/androidruntime(912): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:553) 10-14 04:53:02.205: e/androidruntime(912): @ dalvik.system.nativestart.main(native method)

here's [screenshot][1] of table.

https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-xpf1/v/t34.0-12/1958582_10152484345338178_1225744402895431728_n.jpg?oh=f5170a80b5336193a28f86ed1293268e&oe=543f72bc&gda=1413426615_2ae1ecb312ef73ff1dd20ee5d006d753

android listview parse.com android-parsequeryadapter

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -