android - "cannot resolve constructor FirebaseRecyclerAdapter" when trying to use FirebaseUI -
i using firebaseui's firebaserecycleradapter described in github.
but getting error (cannot resolve constructor firebaserecycleradapter
). tried possible still getting same error.
here activity
firebase ref = new firebase("https://myapp.firebaseio.com/shoplist"); recyclerview recyclerview; string enteredshopname; private firebaserecycleradapter<chat, chatholder> mrecyclerviewadapter; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); recyclerview = (recyclerview) findviewbyid(r.id.recyclerview); recyclerview.sethasfixedsize(true); recyclerview.setlayoutmanager(new linearlayoutmanager(this)); floatingactionbutton fab = (floatingactionbutton) findviewbyid(r.id.fab); fab.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { createdialog(); } }); } @override protected void onstart() { super.onstart(); attachrecyclerviewadapter(); } private void attachrecyclerviewadapter() { mrecyclerviewadapter = new firebaserecycleradapter<chat, chatholder>( chat.class, r.layout.message, chatholder.class, ref) { @override public void populateviewholder(chatholder chatview, chat chat, int position) { chatview.setname(chat.getname()); } }; } }); mrecyclerviewadapter.setadapter(mrecyclerviewadapter); } private void createdialog() { alertdialog.builder dialogbuilder = new alertdialog.builder(this); layoutinflater inflater = this.getlayoutinflater(); final view dialogview = inflater.inflate(r.layout.addshop_dialog, null); dialogbuilder.setview(dialogview); final edittext randeephooda = (edittext) dialogview.findviewbyid(r.id.et_shopname); enteredshopname = randeephooda.gettext().tostring(); dialogbuilder.settitle("add shop"); dialogbuilder.setpositivebutton("add", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int whichbutton) { //do edt.gettext().tostring(); chat chat = new chat(enteredshopname); ref.push().setvalue(chat); } }); dialogbuilder.setnegativebutton("cancel", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int whichbutton) { //pass } }); alertdialog b = dialogbuilder.create(); b.show(); }
my pojo
string name; public chat() { } public chat(string name) { this.name = name; } public string getname() { return name; }
my viewholder
public chatholder(view itemview) { super(itemview); mview = itemview; } public void setname(string name) { textview field = (textview) mview.findviewbyid(r.id.shoprecyclerview_textview); field.settext(name); } }
change
mrecyclerviewadapter.setadapter(mrecyclerviewadapter);//this line caused error
to
recyclerview.setadapter(mrecyclerviewadapter);//need set adapter recyclerview
done.
Comments
Post a Comment