android - App crashes when I set FirebaseAdapterUI -


chatactivity crashes when received message in firebase adapter ui. when set simple_list_item_1 layout, works fine, when set 2 or more attributes, app crashed on receiving message.

import android.content.intent; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.listview; import android.widget.textview;  import com.firebase.ui.database.firebaselistadapter; import com.google.firebase.auth.firebaseauth; import com.google.firebase.database.databasereference; import com.google.firebase.database.firebasedatabase;  public class profileacrivity extends appcompatactivity {     button log_out;     firebaseauth firebaseauth;     databasereference databasereference;     button send;     edittext messgae;     listview messagelist;     firebaselistadapter<chat>firebaselistadapter;     @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_profile_acrivity);         firebaseauth = firebaseauth.getinstance();         log_out = (button) findviewbyid(r.id.log_out);         send= (button) findviewbyid(r.id.send);         messgae= (edittext) findviewbyid(r.id.mess_text);         messagelist= (listview) findviewbyid(r.id.mess_list);          if (firebaseauth.getcurrentuser() == null) {             finish();             startactivity(new intent(getapplicationcontext(), login.class));         }         databasereference= firebasedatabase.getinstance().getreference().child("group");          log_out.setonclicklistener(new view.onclicklistener() {             @override             public void onclick(view v) {                 logout();             }         });         send.setonclicklistener(new view.onclicklistener() {             @override             public void onclick(view v) {                 messagesend();             }         });          messagerecieved();       }      void logout() {         firebaseauth.signout();         finish();         startactivity(new intent(getapplicationcontext(), login.class));     }      void messagesend()     {         databasereference.push().setvalue(new chat(messgae.gettext().tostring(),firebaseauth.getcurrentuser().getemail()));         messgae.settext(" ");     }     void messagerecieved()     {          firebaselistadapter=new firebaselistadapter<chat>(this,chat.class,android.r.layout.two_line_list_item,databasereference) {             @override             protected void populateview(view v, chat model, int position) {                 ((textview) v.findviewbyid(android.r.id.text1)).settext(model.getname());                 ((textview) v.findviewbyid(android.r.id.text2)).settext(model.getmessage());             }         };         messagelist.setadapter(firebaselistadapter);     } } 

this chat.java file

    public class chat {     string message;     string name;     //string time;      public chat(string message,string user)     {         this.message=message;         this.name=user;     }        public string getmessage() {         return message;     }      public void setmessage(string message) {         this.message = message;     }      public string getname() {         return name;     }      public void setname(string name) {         this.name = name;     } } 

stack trace:

02-10 01:15:07.106 15809-15809/a52.puri.fbkunal.com.firebase e/androidruntime: fatal exception: main                                                                            process: a52.puri.fbkunal.com.firebase, pid: 15809                                                                            com.google.firebase.database.databaseexception: class a52.puri.fbkunal.com.firebase.chat missing constructor no arguments                                                                                @ com.google.android.gms.internal.zzbqi$zza.zze(unknown source)                                                                                @ com.google.android.gms.internal.zzbqi$zza.zzag(unknown source)                                                                                @ com.google.android.gms.internal.zzbqi.zze(unknown source)                                                                                @ com.google.android.gms.internal.zzbqi.zzb(unknown source)                                                                                @ com.google.android.gms.internal.zzbqi.zza(unknown source)                                                                                @ com.google.firebase.database.datasnapshot.getvalue(unknown source)                                                                                @ com.firebase.ui.database.firebaselistadapter.parsesnapshot(firebaselistadapter.java:127)                                                                                @ com.firebase.ui.database.firebaselistadapter.getitem(firebaselistadapter.java:116)                                                                                @ com.firebase.ui.database.firebaselistadapter.getview(firebaselistadapter.java:146)                                                                                @ android.widget.abslistview.obtainview(abslistview.java:2306)                                                                                @ android.widget.listview.makeandaddview(listview.java:1811)                                                                                @ android.widget.listview.filldown(listview.java:697)                                                                                @ android.widget.listview.fillfromtop(listview.java:763)                                                                                @ android.widget.listview.layoutchildren(listview.java:1627)                                                                                @ android.widget.abslistview.onlayout(abslistview.java:2162)                                                                                @ android.view.view.layout(view.java:14981)                                                                                @ android.view.viewgroup.layout(viewgroup.java:4790)                                                                                @ android.widget.relativelayout.onlayout(relativelayout.java:1055)                                                                                @ android.view.view.layout(view.java:14981)                                                                                @ android.view.viewgroup.layout(viewgroup.java:4790)                                                                                @ android.widget.framelayout.layoutchildren(framelayout.java:453)                                                                                @ android.widget.framelayout.onlayout(framelayout.java:388)                                                                                @ android.view.view.layout(view.java:14981)                                                                                @ android.view.viewgroup.layout(viewgroup.java:4790)                                                                                @ android.support.v7.widget.actionbaroverlaylayout.onlayout(actionbaroverlaylayout.java:437)                                                                                @ android.view.view.layout(view.java:14981)                                                                                @ android.view.viewgroup.layout(viewgroup.java:4790)                                                                                @ android.widget.framelayout.layoutchildren(framelayout.java:453)                                                                                @ android.widget.framelayout.onlayout(framelayout.java:388)                                                                                @ android.view.view.layout(view.java:14981)                                                                                @ android.view.viewgroup.layout(viewgroup.java:4790)                                                                                @ android.widget.linearlayout.setchildframe(linearlayout.java:1671)                                                                                @ android.widget.linearlayout.layoutvertical(linearlayout.java:1525)                                                                                @ android.widget.linearlayout.onlayout(linearlayout.java:1434)                                                                                @ android.view.view.layout(view.java:14981)                                                                                @ android.view.viewgroup.layout(viewgroup.java:4790)                                                                                @ android.widget.framelayout.layoutchildren(framelayout.java:453)                                                                                @ android.widget.framelayout.onlayout(framelayout.java:388)                                                                                @ android.view.view.layout(view.java:14981)                                                                                @ android.view.viewgroup.layout(viewgroup.java:4790)                                                                                @ android.view.viewrootimpl.performlayout(viewrootimpl.java:1998)                                                                                @ android.view.viewrootimpl.performtraversals(viewrootimpl.java:1753)                                                                                @ android.view.viewrootimpl.dotraversal(viewrootimpl.java:1006)                                                                                @ android.view.viewrootimpl$traversalrunnable.run(viewrootimpl.java:5652)                                                                                @ android.view.choreographer$callbackrecord.run(choreographer.java:761)                                                                                @ android.view.choreographer.docallbacks(choreographer.java:574)                                                                                @ android.view.choreographer.doframe(choreographer.java:544)                                                                                @ android.view.choreographer$framedisplayeventreceiver.run(choreographer.java:747)                                                                                @ android.os.handler.handlecallback(handler.java:733)                                                                                @ android.os.handler.dispatchmessage(handler.java:95)                                                                                @ android.os.looper.loop(looper.java:136)                                                                                @ android.app.activitythread.main(activitythread.java:5433)                                                                                @ java.lang.reflect.method.invokenative(native method)                                                                                @ java.lang.reflect.method.invoke(method.java:515)                                                                                @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1268)                                                                                @ com.android.internal.os.zygoteinit.main(zygoteinit.java:1084)                                                                                @ dalvik.system.nativestart.main(native method) 02-10 01:15:11.770 15809-15850/a52.puri.fbkunal.com.firebase w/dynamitemodule: local module descriptor class com.google.firebase.auth not found. 

make constructor of type

chat(){}  

inside chat class.

firebase needs default constructor. since have parameterized one, need explicitly declare constructor no arguments compiler won't anymore.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -